#include "calendar.h"

Calendar::~Calendar()
{
    free(times);
}
// 初始化成员函数
void Calendar::Init()
{
    solarYear = 0;          // 公历年 4 位数字
    solarMonth = 0;         // 公历月
    solarDay = 0;           // 公历日
    solarHour = 0;          // 公历小时
    solarMin = 0;           // 公历分
    solarSecond = 0;        // 公历秒

    lunarYear = 0;           // 公元年 4 位数字
    lunarMonth = 0;          // 农历月 数字
    lunarDay = 0;            // 农历日子
    isBigMonth = false;      // 农历的月是月大还是月小，月大 30 天，月小 29 天。
    isLeapMonth = false;     // 是否为农历闰月

    lunarYearZhu = "";    // 年柱信息(两个字)，如 甲子
    lunarMonthZhu = "";   // 月柱信息(两个字)，如 甲子
    lunarDayZhu = "";     // 日柱信息(两个字)，如 甲子
    lunarHourZhu = "";    // 时柱信息(两个字)，如 甲子
    jieQiOne = "";        // 节气信息1
    jieQiTwo = "";        // 节气信息2
}

Calendar::Calendar()
{
    // (农历信息表) 每月只能是29或30天，一年用12（或13）个二进制位表示，对应位为1表30天，否则为29天
    lunarInfo = {
        0x4bd8,0x4ae0,0xa570,0x54d5,0xd260,0xd950,0x5554,0x56af,0x9ad0,0x55d2, //1900-1909
        0x4ae0,0xa5b6,0xa4d0,0xd250,0xd255,0xb54f,0xd6a0,0xada2,0x95b0,0x4977, //1910-1919
        0x497f,0xa4b0,0xb4b5,0x6a50,0x6d40,0xab54,0x2b6f,0x9570,0x52f2,0x4970, //1920-1929
        0x6566,0xd4a0,0xea50,0x6a95,0x5adf,0x2b60,0x86e3,0x92ef,0xc8d7,0xc95f, //1930-1939
        0xd4a0,0xd8a6,0xb55f,0x56a0,0xa5b4,0x25df,0x92d0,0xd2b2,0xa950,0xb557, //1940-1949
        0x6ca0,0xb550,0x5355,0x4daf,0xa5b0,0x4573,0x52bf,0xa9a8,0xe950,0x6aa0, //1950-1959
        0xaea6,0xab50,0x4b60,0xaae4,0xa570,0x5260,0xf263,0xd950,0x5b57,0x56a0, //1960-1969
        0x96d0,0x4dd5,0x4ad0,0xa4d0,0xd4d4,0xd250,0xd558,0xb540,0xb6a0,0x95a6, //1970-1979
        0x95bf,0x49b0,0xa974,0xa4b0,0xb27a,0x6a50,0x6d40,0xaf46,0xab60,0x9570, //1980-1989
        0x4af5,0x4970,0x64b0,0x74a3,0xea50,0x6b58,0x5ac0,0xab60,0x96d5,0x92e0, //1990-1999
        0xc960,0xd954,0xd4a0,0xda50,0x7552,0x56a0,0xabb7,0x25d0,0x92d0,0xcab5, //2000-2009
        0xa950,0xb4a0,0xbaa4,0xad50,0x55d9,0x4ba0,0xa5b0,0x5176,0x52bf,0xa930, //2010-2019
        0x7954,0x6aa0,0xad50,0x5b52,0x4b60,0xa6e6,0xa4e0,0xd260,0xea65,0xd530, //2020-2029
        0x5aa0,0x76a3,0x96d0,0x4afb,0x4ad0,0xa4d0,0xd0b6,0xd25f,0xd520,0xdd45, //2030-2039
        0xb5a0,0x56d0,0x55b2,0x49b0,0xa577,0xa4b0,0xaa50,0xb255,0x6d2f,0xada0, //2040-2049
        0x4b63,0x937f,0x49f8,0x4970,0x64b0,0x68a6,0xea5f,0x6b20,0xa6c4,0xaaef, //2050-2059
        0x92e0,0xd2e3,0xc960,0xd557,0xd4a0,0xda50,0x5d55,0x56a0,0xa6d0,0x55d4, //2060-2069
        0x52d0,0xa9b8,0xa950,0xb4a0,0xb6a6,0xad50,0x55a0,0xaba4,0xa5b0,0x52b0, //2070-2079
        0xb273,0x6930,0x7337,0x6aa0,0xad50,0x4b55,0x4b6f,0xa570,0x54e4,0xd260, //2080-2089
        0xe968,0xd520,0xdaa0,0x6aa6,0x56df,0x4ae0,0xa9d4,0xa4d0,0xd150,0xf252, //2090-2099
        0x0d520//2100
    };
    // 天干信息表
    tianGan = { "甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸" };
    // 地支信息表
    diZhi = { "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥" };
    // 节气->序号
    jieQiInfo =
    {
        {"小寒", 0}, {"大寒", 1}, {"立春", 2}, {"雨水", 3}, {"惊蛰", 4}, {"春分", 5},
        {"清明", 6}, {"谷雨", 7}, {"立夏", 8}, {"小满", 9}, {"芒种", 10}, {"夏至", 11},
        {"小暑", 12}, {"大暑", 13}, {"立秋", 14}, {"处暑", 15}, {"白露", 16}, {"秋分", 17},
        {"寒露", 18}, {"霜降", 19}, {"立冬", 20}, {"小雪", 21}, {"大雪", 22}, {"冬至", 23}
    };
    // 序号->节气
    jieQiInfoIndex =
    {
        {0, "小寒"}, {1, "大寒"}, {2, "立春"}, {3, "雨水"}, {4, "惊蛰"}, {5, "春分"},
        {6, "清明"}, {7, "谷雨"}, {8, "立夏"}, {9, "小满"}, {10, "芒种"}, {11, "夏至"},
        {12, "小暑"}, {13, "大暑"}, {14, "立秋"}, {15, "处暑"}, {16, "白露"}, {17, "秋分"},
        {18, "寒露"}, {19, "霜降"}, {20, "立冬"}, {21, "小雪"}, {22, "大雪"}, {23, "冬至"}
    };
    // 序号->查60甲子
    sixtyJiazi =
    {
        {0, "甲子"},  {1, "乙丑"},  {2, "丙寅"},  {3, "丁卯"},  {4, "戊辰"},  {5, "己巳"},  {6, "庚午"},  {7, "辛未"},  {8, "壬申"},  {9, "癸酉"},
        {10, "甲戌"}, {11, "乙亥"}, {12, "丙子"}, {13, "丁丑"}, {14, "戊寅"}, {15, "己卯"}, {16, "庚辰"}, {17, "辛巳"}, {18, "壬午"}, {19, "癸未"},
        {20, "甲申"}, {21, "乙酉"}, {22, "丙戌"}, {23, "丁亥"}, {24, "戊子"}, {25, "己丑"}, {26, "庚寅"}, {27, "辛卯"}, {28, "壬辰"}, {29, "癸巳"},
        {30, "甲午"}, {31, "乙未"}, {32, "丙申"}, {33, "丁酉"}, {34, "戊戌"}, {35, "己亥"}, {36, "庚子"}, {37, "辛丑"}, {38, "壬寅"}, {39, "癸卯"},
        {40, "甲辰"}, {41, "乙巳"}, {42, "丙午"}, {43, "丁未"}, {44, "戊申"}, {45, "己酉"}, {46, "庚戌"}, {47, "辛亥"}, {48, "壬子"}, {49, "癸丑"},
        {50, "甲寅"}, {51, "乙卯"}, {52, "丙辰"}, {53, "丁巳"}, {54, "戊午"}, {55, "己未"}, {56, "庚申"}, {57, "辛酉"}, {58, "壬戌"}, {59, "癸亥"},
    };
    // 60甲子->序号
    sixtyJiaziIndex =
    {
        {"甲子", 0},  {"乙丑", 1},  {"丙寅", 2},  {"丁卯", 3},  {"戊辰", 4},  {"己巳", 5},  {"庚午", 6},  {"辛未", 7},  {"壬申", 8},  {"癸酉", 9},
        {"甲戌", 10}, {"乙亥", 11}, {"丙子", 12}, {"丁丑", 13}, {"戊寅", 14}, {"己卯", 15}, {"庚辰", 16}, {"辛巳", 17}, {"壬午", 18}, {"癸未", 19},
        {"甲申", 20}, {"乙酉", 21}, {"丙戌", 22}, {"丁亥", 23}, {"戊子", 24}, {"己丑", 25}, {"庚寅", 26}, {"辛卯", 27}, {"壬辰", 28}, {"癸巳", 29},
        {"甲午", 30}, {"乙未", 31}, {"丙申", 32}, {"丁酉", 33}, {"戊戌", 34}, {"己亥", 35}, {"庚子", 36}, {"辛丑", 37}, {"壬寅", 38}, {"癸卯", 39},
        {"甲辰", 40}, {"乙巳", 41}, {"丙午", 42}, {"丁未", 43}, {"戊申", 44}, {"己酉", 45}, {"庚戌", 46}, {"辛亥", 47}, {"壬子", 48}, {"癸丑", 49},
        {"甲寅", 50}, {"乙卯", 51}, {"丙辰", 52}, {"丁巳", 53}, {"戊午", 54}, {"己未", 55}, {"庚申", 56}, {"辛酉", 57}, {"壬戌", 58}, {"癸亥", 59},
    };
    // 五虎遁年起月表
    wuHu =
    {
        {"甲", "丙"}, {"己", "丙"}, {"乙", "戊"}, {"庚", "戊"}, {"丙", "庚"}, {"辛", "庚"}, {"丁", "壬"}, {"壬", "壬"}, {"戊", "甲"}, {"癸", "甲"}
    };
    // 日上起时法表
    qiShi =
    {
        {"甲", "甲"}, {"己", "甲"}, {"乙", "丙"}, {"庚", "丙"}, {"丙", "戊"}, {"辛", "戊"}, {"丁", "庚"}, {"壬", "庚"}, {"戊", "壬"}, {"癸", "壬"}
    };
    // 各节气之间相差的秒数(精确数据，用于计算节气的具体时间)
    times = (int*)malloc(4776 * sizeof(int));
    memset(times, 0, 4776 * sizeof(int));
    times[0] = 1272508; times[1] = 1275546; times[2] = 1282183; times[3] = 1290038; times[4] = 1300629; times[5] = 1311220; times[6] = 1323265; times[7] = 1333686; times[8] = 1344103; times[9] = 1351320; times[10] = 1357250; times[11] = 1359023; times[12] = 1358759; times[13] = 1354467; times[14] = 1348155; times[15] = 1339009; times[16] = 1328613; times[17] = 1317178; times[18] = 1305727; times[19] = 1295068; times[20] = 1285686; times[21] = 1278480; times[22] = 1273544; times[23] = 1271509;
    times[24] = 1272185; times[25] = 1275804; times[26] = 1281902; times[27] = 1290359; times[28] = 1300362; times[29] = 1311646; times[30] = 1322945; times[31] = 1334218; times[32] = 1343655; times[33] = 1351908; times[34] = 1356679; times[35] = 1359588; times[36] = 1358171; times[37] = 1354941; times[38] = 1347683; times[39] = 1339366; times[40] = 1328321; times[41] = 1317452; times[42] = 1305586; times[43] = 1295295; times[44] = 1285604; times[45] = 1278684; times[46] = 1273438; times[47] = 1271698;
    times[48] = 1272023; times[49] = 1275974; times[50] = 1281692; times[51] = 1290470; times[52] = 1300141; times[53] = 1311653; times[54] = 1322802; times[55] = 1334080; times[56] = 1343683; times[57] = 1351576; times[58] = 1356921; times[59] = 1359071; times[60] = 1358613; times[61] = 1354344; times[62] = 1348247; times[63] = 1338802; times[64] = 1328935; times[65] = 1316990; times[66] = 1306228; times[67] = 1294928; times[68] = 1286257; times[69] = 1278338; times[70] = 1274070; times[71] = 1271292;
    times[72] = 1272589; times[73] = 1275465; times[74] = 1282171; times[75] = 1289884; times[76] = 1300554; times[77] = 1311067; times[78] = 1323166; times[79] = 1333603; times[80] = 1343979; times[81] = 1351326; times[82] = 1357068; times[83] = 1359101; times[84] = 1358529; times[85] = 1354625; times[86] = 1347945; times[87] = 1339246; times[88] = 1328480; times[89] = 1317483; times[90] = 1305679; times[91] = 1295420; times[92] = 1285681; times[93] = 1278835; times[94] = 1273506; times[95] = 1271797;
    times[96] = 1272049; times[97] = 1275976; times[98] = 1281644; times[99] = 1290408; times[100] = 1300015; times[101] = 1311617; times[102] = 1322597; times[103] = 1334186; times[104] = 1343421; times[105] = 1351923; times[106] = 1356623; times[107] = 1359620; times[108] = 1358274; times[109] = 1354936; times[110] = 1347873; times[111] = 1339294; times[112] = 1328534; times[113] = 1317322; times[114] = 1305808; times[115] = 1295156; times[116] = 1285855; times[117] = 1278567; times[118] = 1273716; times[119] = 1271590;
    times[120] = 1272290; times[121] = 1275833; times[122] = 1281909; times[123] = 1290278; times[124] = 1300315; times[125] = 1311417; times[126] = 1322957; times[127] = 1333819; times[128] = 1343832; times[129] = 1351337; times[130] = 1357069; times[131] = 1358917; times[132] = 1358738; times[133] = 1354280; times[134] = 1348299; times[135] = 1338790; times[136] = 1328890; times[137] = 1316980; times[138] = 1306099; times[139] = 1294911; times[140] = 1286107; times[141] = 1278354; times[142] = 1273974; times[143] = 1271386;
    times[144] = 1272587; times[145] = 1275640; times[146] = 1282233; times[147] = 1290099; times[148] = 1300601; times[149] = 1311269; times[150] = 1323114; times[151] = 1333759; times[152] = 1343786; times[153] = 1351439; times[154] = 1356774; times[155] = 1359208; times[156] = 1358236; times[157] = 1354742; times[158] = 1347718; times[159] = 1339360; times[160] = 1328327; times[161] = 1317594; times[162] = 1305590; times[163] = 1295531; times[164] = 1285617; times[165] = 1278934; times[166] = 1273431; times[167] = 1271889;
    times[168] = 1271962; times[169] = 1276082; times[170] = 1281569; times[171] = 1290527; times[172] = 1299954; times[173] = 1311708; times[174] = 1322546; times[175] = 1334182; times[176] = 1343379; times[177] = 1351782; times[178] = 1356603; times[179] = 1359371; times[180] = 1358326; times[181] = 1354682; times[182] = 1348045; times[183] = 1339119; times[184] = 1328810; times[185] = 1317230; times[186] = 1306128; times[187] = 1295087; times[188] = 1286146; times[189] = 1278443; times[190] = 1273926; times[191] = 1271375;
    times[192] = 1272417; times[193] = 1275549; times[194] = 1282001; times[195] = 1289980; times[196] = 1300420; times[197] = 1311152; times[198] = 1323089; times[199] = 1333625; times[200] = 1343986; times[201] = 1351257; times[202] = 1357198; times[203] = 1358939; times[204] = 1358765; times[205] = 1354357; times[206] = 1348217; times[207] = 1338917; times[208] = 1328759; times[209] = 1317156; times[210] = 1305956; times[211] = 1295114; times[212] = 1285956; times[213] = 1278540; times[214] = 1273787; times[215] = 1271509;
    times[216] = 1272342; times[217] = 1275696; times[218] = 1281948; times[219] = 1290148; times[220] = 1300329; times[221] = 1311389; times[222] = 1322899; times[223] = 1333986; times[224] = 1343642; times[225] = 1351744; times[226] = 1356695; times[227] = 1359506; times[228] = 1358189; times[229] = 1354922; times[230] = 1347662; times[231] = 1339385; times[232] = 1328274; times[233] = 1317519; times[234] = 1305562; times[235] = 1295433; times[236] = 1285632; times[237] = 1278874; times[238] = 1273498; times[239] = 1271890;
    times[240] = 1272059; times[241] = 1276106; times[242] = 1281645; times[243] = 1290503; times[244] = 1299982; times[245] = 1311603; times[246] = 1322567; times[247] = 1334018; times[248] = 1343448; times[249] = 1351572; times[250] = 1356741; times[251] = 1359141; times[252] = 1358514; times[253] = 1354452; times[254] = 1348212; times[255] = 1338890; times[256] = 1328914; times[257] = 1317021; times[258] = 1306203; times[259] = 1294935; times[260] = 1286247; times[261] = 1278363; times[262] = 1274090; times[263] = 1271349;
    times[264] = 1272631; times[265] = 1275533; times[266] = 1282200; times[267] = 1289914; times[268] = 1300530; times[269] = 1311012; times[270] = 1323083; times[271] = 1333463; times[272] = 1343895; times[273] = 1351159; times[274] = 1357058; times[275] = 1358965; times[276] = 1358621; times[277] = 1354549; times[278] = 1348112; times[279] = 1339219; times[280] = 1328654; times[281] = 1317446; times[282] = 1305795; times[283] = 1295329; times[284] = 1285733; times[285] = 1278701; times[286] = 1273535; times[287] = 1271660;
    times[288] = 1272097; times[289] = 1275865; times[290] = 1281723; times[291] = 1290325; times[292] = 1300100; times[293] = 1311536; times[294] = 1322646; times[295] = 1334082; times[296] = 1343403; times[297] = 1351823; times[298] = 1356562; times[299] = 1359591; times[300] = 1358218; times[301] = 1355010; times[302] = 1347849; times[303] = 1339460; times[304] = 1328540; times[305] = 1317523; times[306] = 1305798; times[307] = 1295318; times[308] = 1285770; times[309] = 1278645; times[310] = 1273546; times[311] = 1271595;
    times[312] = 1272070; times[313] = 1275814; times[314] = 1281694; times[315] = 1290286; times[316] = 1300137; times[317] = 1311476; times[318] = 1322820; times[319] = 1333908; times[320] = 1343712; times[321] = 1351413; times[322] = 1356962; times[323] = 1358966; times[324] = 1358689; times[325] = 1354326; times[326] = 1348342; times[327] = 1338855; times[328] = 1329017; times[329] = 1317059; times[330] = 1306269; times[331] = 1294973; times[332] = 1286250; times[333] = 1278349; times[334] = 1274030; times[335] = 1271280;
    times[336] = 1272538; times[337] = 1275447; times[338] = 1282118; times[339] = 1289874; times[340] = 1300494; times[341] = 1311068; times[342] = 1323082; times[343] = 1333611; times[344] = 1343855; times[345] = 1351338; times[346] = 1356904; times[347] = 1359132; times[348] = 1358380; times[349] = 1354699; times[350] = 1347863; times[351] = 1339372; times[352] = 1328481; times[353] = 1317660; times[354] = 1305749; times[355] = 1295625; times[356] = 1285760; times[357] = 1279004; times[358] = 1273517; times[359] = 1271874;
    times[360] = 1271954; times[361] = 1275956; times[362] = 1281457; times[363] = 1290313; times[364] = 1299778; times[365] = 1311481; times[366] = 1322371; times[367] = 1334038; times[368] = 1343259; times[369] = 1351784; times[370] = 1356553; times[371] = 1359505; times[372] = 1358316; times[373] = 1354880; times[374] = 1348037; times[375] = 1339327; times[376] = 1328800; times[377] = 1317427; times[378] = 1306127; times[379] = 1295279; times[380] = 1286148; times[381] = 1278627; times[382] = 1273911; times[383] = 1271523;
    times[384] = 1272346; times[385] = 1275625; times[386] = 1281841; times[387] = 1289962; times[388] = 1300169; times[389] = 1311059; times[390] = 1322806; times[391] = 1333510; times[392] = 1343765; times[393] = 1351189; times[394] = 1357122; times[395] = 1358952; times[396] = 1358855; times[397] = 1354427; times[398] = 1348416; times[399] = 1338988; times[400] = 1328984; times[401] = 1317188; times[402] = 1306160; times[403] = 1295104; times[404] = 1286129; times[405] = 1278505; times[406] = 1273940; times[407] = 1271458;
    times[408] = 1272471; times[409] = 1275614; times[410] = 1282032; times[411] = 1290004; times[412] = 1300343; times[413] = 1311163; times[414] = 1322848; times[415] = 1333700; times[416] = 1343569; times[417] = 1351479; times[418] = 1356666; times[419] = 1359357; times[420] = 1358252; times[421] = 1354942; times[422] = 1347811; times[423] = 1339543; times[424] = 1328445; times[425] = 1317722; times[426] = 1305689; times[427] = 1295597; times[428] = 1285678; times[429] = 1278967; times[430] = 1273478; times[431] = 1271926;
    times[432] = 1272009; times[433] = 1276113; times[434] = 1281576; times[435] = 1290494; times[436] = 1299882; times[437] = 1311575; times[438] = 1322411; times[439] = 1333968; times[440] = 1343236; times[441] = 1351530; times[442] = 1356517; times[443] = 1359153; times[444] = 1358356; times[445] = 1354561; times[446] = 1348183; times[447] = 1339099; times[448] = 1329011; times[449] = 1317280; times[450] = 1306350; times[451] = 1295165; times[452] = 1286350; times[453] = 1278507; times[454] = 1274098; times[455] = 1271401;
    times[456] = 1272552; times[457] = 1275523; times[458] = 1282082; times[459] = 1289884; times[460] = 1300416; times[461] = 1310979; times[462] = 1322991; times[463] = 1333405; times[464] = 1343824; times[465] = 1351052; times[466] = 1357014; times[467] = 1358820; times[468] = 1358636; times[469] = 1354415; times[470] = 1348215; times[471] = 1339161; times[472] = 1328861; times[473] = 1317482; times[474] = 1306074; times[475] = 1295416; times[476] = 1286017; times[477] = 1278760; times[478] = 1273754; times[479] = 1271626;
    times[480] = 1272213; times[481] = 1275726; times[482] = 1281751; times[483] = 1290125; times[484] = 1300093; times[485] = 1311339; times[486] = 1322653; times[487] = 1333930; times[488] = 1343426; times[489] = 1351719; times[490] = 1356563; times[491] = 1359531; times[492] = 1358177; times[493] = 1355001; times[494] = 1347781; times[495] = 1339517; times[496] = 1328493; times[497] = 1317663; times[498] = 1305811; times[499] = 1295535; times[500] = 1285829; times[501] = 1278893; times[502] = 1273600; times[503] = 1271804;
    times[504] = 1272059; times[505] = 1275933; times[506] = 1281584; times[507] = 1290313; times[508] = 1299949; times[509] = 1311463; times[510] = 1322613; times[511] = 1333923; times[512] = 1343543; times[513] = 1351485; times[514] = 1356850; times[515] = 1359059; times[516] = 1358621; times[517] = 1354390; times[518] = 1348302; times[519] = 1338872; times[520] = 1329003; times[521] = 1317054; times[522] = 1306299; times[523] = 1294995; times[524] = 1286337; times[525] = 1278418; times[526] = 1274158; times[527] = 1271372;
    times[528] = 1272659; times[529] = 1275510; times[530] = 1282185; times[531] = 1289860; times[532] = 1300484; times[533] = 1310967; times[534] = 1323032; times[535] = 1333458; times[536] = 1343843; times[537] = 1351202; times[538] = 1356984; times[539] = 1359046; times[540] = 1358533; times[541] = 1354650; times[542] = 1348021; times[543] = 1339330; times[544] = 1328593; times[545] = 1317593; times[546] = 1305807; times[547] = 1295540; times[548] = 1285797; times[549] = 1278929; times[550] = 1273574; times[551] = 1271828;
    times[552] = 1272045; times[553] = 1275932; times[554] = 1281563; times[555] = 1290286; times[556] = 1299856; times[557] = 1311425; times[558] = 1322386; times[559] = 1333961; times[560] = 1343219; times[561] = 1351745; times[562] = 1356504; times[563] = 1359569; times[564] = 1358298; times[565] = 1355040; times[566] = 1348036; times[567] = 1339524; times[568] = 1328781; times[569] = 1317592; times[570] = 1306047; times[571] = 1295371; times[572] = 1285996; times[573] = 1278657; times[574] = 1273720; times[575] = 1271540;
    times[576] = 1272168; times[577] = 1275671; times[578] = 1281704; times[579] = 1290056; times[580] = 1300073; times[581] = 1311182; times[582] = 1322726; times[583] = 1333626; times[584] = 1343686; times[585] = 1351266; times[586] = 1357067; times[587] = 1359006; times[588] = 1358883; times[589] = 1354487; times[590] = 1348539; times[591] = 1339057; times[592] = 1329163; times[593] = 1317236; times[594] = 1306333; times[595] = 1295089; times[596] = 1286231; times[597] = 1278397; times[598] = 1273945; times[599] = 1271270;
    times[600] = 1272414; times[601] = 1275397; times[602] = 1281974; times[603] = 1289811; times[604] = 1300336; times[605] = 1311021; times[606] = 1322918; times[607] = 1333606; times[608] = 1343702; times[609] = 1351409; times[610] = 1356812; times[611] = 1359300; times[612] = 1358393; times[613] = 1354938; times[614] = 1347960; times[615] = 1339616; times[616] = 1328598; times[617] = 1317843; times[618] = 1305820; times[619] = 1295711; times[620] = 1285751; times[621] = 1279013; times[622] = 1273458; times[623] = 1271862;
    times[624] = 1271888; times[625] = 1275951; times[626] = 1281387; times[627] = 1290298; times[628] = 1299687; times[629] = 1311429; times[630] = 1322266; times[631] = 1333937; times[632] = 1343166; times[633] = 1351631; times[634] = 1356501; times[635] = 1359338; times[636] = 1358348; times[637] = 1354768; times[638] = 1348182; times[639] = 1339317; times[640] = 1329041; times[641] = 1317499; times[642] = 1306403; times[643] = 1295368; times[644] = 1286391; times[645] = 1278666; times[646] = 1274079; times[647] = 1271479;
    times[648] = 1272431; times[649] = 1275494; times[650] = 1281851; times[651] = 1289763; times[652] = 1300126; times[653] = 1310824; times[654] = 1322732; times[655] = 1333286; times[656] = 1343683; times[657] = 1351018; times[658] = 1357042; times[659] = 1358868; times[660] = 1358806; times[661] = 1354482; times[662] = 1348440; times[663] = 1339202; times[664] = 1329087; times[665] = 1317493; times[666] = 1306292; times[667] = 1295417; times[668] = 1286221; times[669] = 1278743; times[670] = 1273928; times[671] = 1271565;
    times[672] = 1272325; times[673] = 1275586; times[674] = 1281770; times[675] = 1289882; times[676] = 1300017; times[677] = 1311020; times[678] = 1322529; times[679] = 1333609; times[680] = 1343330; times[681] = 1351490; times[682] = 1356554; times[683] = 1359472; times[684] = 1358278; times[685] = 1355117; times[686] = 1347935; times[687] = 1339720; times[688] = 1328621; times[689] = 1317865; times[690] = 1305877; times[691] = 1295702; times[692] = 1285842; times[693] = 1279024; times[694] = 1273580; times[695] = 1271905;
    times[696] = 1272009; times[697] = 1275993; times[698] = 1281485; times[699] = 1290309; times[700] = 1299768; times[701] = 1311388; times[702] = 1322342; times[703] = 1333805; times[704] = 1343233; times[705] = 1351394; times[706] = 1356586; times[707] = 1359065; times[708] = 1358496; times[709] = 1354527; times[710] = 1348351; times[711] = 1339102; times[712] = 1329161; times[713] = 1317287; times[714] = 1306462; times[715] = 1295163; times[716] = 1286436; times[717] = 1278501; times[718] = 1274177; times[719] = 1271391;
    times[720] = 1272624; times[721] = 1275491; times[722] = 1282118; times[723] = 1289808; times[724] = 1300389; times[725] = 1310860; times[726] = 1322903; times[727] = 1333274; times[728] = 1343700; times[729] = 1350963; times[730] = 1356883; times[731] = 1358815; times[732] = 1358533; times[733] = 1354505; times[734] = 1348159; times[735] = 1339325; times[736] = 1328850; times[737] = 1317696; times[738] = 1306109; times[739] = 1295655; times[740] = 1286053; times[741] = 1278972; times[742] = 1273732; times[743] = 1271766;
    times[744] = 1272112; times[745] = 1275791; times[746] = 1281576; times[747] = 1290112; times[748] = 1299848; times[749] = 1311252; times[750] = 1322359; times[751] = 1333790; times[752] = 1343146; times[753] = 1351584; times[754] = 1356375; times[755] = 1359454; times[756] = 1358146; times[757] = 1355012; times[758] = 1347921; times[759] = 1339622; times[760] = 1328760; times[761] = 1317816; times[762] = 1306115; times[763] = 1295665; times[764] = 1286087; times[765] = 1278937; times[766] = 1273756; times[767] = 1271732;
    times[768] = 1272102; times[769] = 1275755; times[770] = 1281539; times[771] = 1290060; times[772] = 1299853; times[773] = 1311167; times[774] = 1322502; times[775] = 1333627; times[776] = 1343485; times[777] = 1351270; times[778] = 1356891; times[779] = 1358981; times[780] = 1358744; times[781] = 1354429; times[782] = 1348462; times[783] = 1339002; times[784] = 1329177; times[785] = 1317229; times[786] = 1306452; times[787] = 1295150; times[788] = 1286425; times[789] = 1278497; times[790] = 1274150; times[791] = 1271348;
    times[792] = 1272559; times[793] = 1275397; times[794] = 1282019; times[795] = 1289709; times[796] = 1300299; times[797] = 1310846; times[798] = 1322865; times[799] = 1333411; times[800] = 1343700; times[801] = 1351234; times[802] = 1356866; times[803] = 1359152; times[804] = 1358465; times[805] = 1354808; times[806] = 1348009; times[807] = 1339507; times[808] = 1328620; times[809] = 1317767; times[810] = 1305850; times[811] = 1295695; times[812] = 1285826; times[813] = 1279061; times[814] = 1273581; times[815] = 1271941;
    times[816] = 1272024; times[817] = 1276006; times[818] = 1281480; times[819] = 1290283; times[820] = 1299693; times[821] = 1311346; times[822] = 1322188; times[823] = 1333837; times[824] = 1343047; times[825] = 1351590; times[826] = 1356390; times[827] = 1359394; times[828] = 1358262; times[829] = 1354891; times[830] = 1348102; times[831] = 1339448; times[832] = 1328940; times[833] = 1317591; times[834] = 1306276; times[835] = 1295426; times[836] = 1286259; times[837] = 1278731; times[838] = 1273971; times[839] = 1271577;
    times[840] = 1272358; times[841] = 1275624; times[842] = 1281795; times[843] = 1289894; times[844] = 1300053; times[845] = 1310918; times[846] = 1322623; times[847] = 1333318; times[848] = 1343565; times[849] = 1351008; times[850] = 1356976; times[851] = 1358861; times[852] = 1358842; times[853] = 1354494; times[854] = 1348568; times[855] = 1339208; times[856] = 1329243; times[857] = 1317453; times[858] = 1306409; times[859] = 1295302; times[860] = 1286271; times[861] = 1278568; times[862] = 1273933; times[863] = 1271374;
    times[864] = 1272336; times[865] = 1275423; times[866] = 1281824; times[867] = 1289766; times[868] = 1300122; times[869] = 1310936; times[870] = 1322660; times[871] = 1333526; times[872] = 1343454; times[873] = 1351396; times[874] = 1356654; times[875] = 1359404; times[876] = 1358372; times[877] = 1355120; times[878] = 1348038; times[879] = 1339807; times[880] = 1328719; times[881] = 1317991; times[882] = 1305937; times[883] = 1295796; times[884] = 1285822; times[885] = 1279033; times[886] = 1273464; times[887] = 1271827;
    times[888] = 1271833; times[889] = 1275876; times[890] = 1281308; times[891] = 1290223; times[892] = 1299637; times[893] = 1311381; times[894] = 1322266; times[895] = 1333887; times[896] = 1343192; times[897] = 1351541; times[898] = 1356548; times[899] = 1359239; times[900] = 1358458; times[901] = 1354707; times[902] = 1348349; times[903] = 1339294; times[904] = 1329211; times[905] = 1317480; times[906] = 1306536; times[907] = 1295325; times[908] = 1286472; times[909] = 1278589; times[910] = 1274120; times[911] = 1271372;
    times[912] = 1272454; times[913] = 1275376; times[914] = 1281875; times[915] = 1289653; times[916] = 1300156; times[917] = 1310737; times[918] = 1322762; times[919] = 1333228; times[920] = 1343699; times[921] = 1350989; times[922] = 1357015; times[923] = 1358869; times[924] = 1358741; times[925] = 1354539; times[926] = 1348385; times[927] = 1339342; times[928] = 1329079; times[929] = 1317717; times[930] = 1306340; times[931] = 1295675; times[932] = 1286263; times[933] = 1278956; times[934] = 1273883; times[935] = 1271670;
    times[936] = 1272169; times[937] = 1275586; times[938] = 1281529; times[939] = 1289816; times[940] = 1299735; times[941] = 1310938; times[942] = 1322261; times[943] = 1333557; times[944] = 1343136; times[945] = 1351500; times[946] = 1356464; times[947] = 1359538; times[948] = 1358296; times[949] = 1355211; times[950] = 1348061; times[951] = 1339853; times[952] = 1328844; times[953] = 1318031; times[954] = 1306153; times[955] = 1295861; times[956] = 1286098; times[957] = 1279112; times[958] = 1273735; times[959] = 1271865;
    times[960] = 1272023; times[961] = 1275809; times[962] = 1281370; times[963] = 1290016; times[964] = 1299583; times[965] = 1311053; times[966] = 1322178; times[967] = 1333524; times[968] = 1343204; times[969] = 1351262; times[970] = 1356740; times[971] = 1359099; times[972] = 1358762; times[973] = 1354646; times[974] = 1348621; times[975] = 1339244; times[976] = 1329378; times[977] = 1317411; times[978] = 1306615; times[979] = 1295248; times[980] = 1286529; times[981] = 1278536; times[982] = 1274210; times[983] = 1271353;
    times[984] = 1272583; times[985] = 1275367; times[986] = 1281997; times[987] = 1289623; times[988] = 1300215; times[989] = 1310676; times[990] = 1322729; times[991] = 1333166; times[992] = 1343577; times[993] = 1350985; times[994] = 1356843; times[995] = 1358989; times[996] = 1358584; times[997] = 1354784; times[998] = 1348259; times[999] = 1339617; times[1000] = 1328934; times[1001] = 1317930; times[1002] = 1306137; times[1003] = 1295814; times[1004] = 1286024; times[1005] = 1279091; times[1006] = 1273688; times[1007] = 1271892;
    times[1008] = 1272070; times[1009] = 1275906; times[1010] = 1281492; times[1011] = 1290154; times[1012] = 1299674; times[1013] = 1311196; times[1014] = 1322115; times[1015] = 1333665; times[1016] = 1342908; times[1017] = 1351433; times[1018] = 1356222; times[1019] = 1359333; times[1020] = 1358137; times[1021] = 1354975; times[1022] = 1348072; times[1023] = 1339677; times[1024] = 1329017; times[1025] = 1317918; times[1026] = 1306406; times[1027] = 1295759; times[1028] = 1286354; times[1029] = 1278986; times[1030] = 1273964; times[1031] = 1271719;
    times[1032] = 1272242; times[1033] = 1275672; times[1034] = 1281609; times[1035] = 1289897; times[1036] = 1299844; times[1037] = 1310916; times[1038] = 1322419; times[1039] = 1333312; times[1040] = 1343368; times[1041] = 1350968; times[1042] = 1356800; times[1043] = 1358793; times[1044] = 1358740; times[1045] = 1354440; times[1046] = 1348589; times[1047] = 1339209; times[1048] = 1329393; times[1049] = 1317528; times[1050] = 1306666; times[1051] = 1295428; times[1052] = 1286563; times[1053] = 1278684; times[1054] = 1274174; times[1055] = 1271411;
    times[1056] = 1272469; times[1057] = 1275351; times[1058] = 1281850; times[1059] = 1289601; times[1060] = 1300086; times[1061] = 1310726; times[1062] = 1322627; times[1063] = 1333318; times[1064] = 1343463; times[1065] = 1351207; times[1066] = 1356681; times[1067] = 1359228; times[1068] = 1358387; times[1069] = 1354982; times[1070] = 1348055; times[1071] = 1339746; times[1072] = 1328763; times[1073] = 1318028; times[1074] = 1306033; times[1075] = 1295923; times[1076] = 1285971; times[1077] = 1279208; times[1078] = 1273627; times[1079] = 1271981;
    times[1080] = 1271950; times[1081] = 1275946; times[1082] = 1281329; times[1083] = 1290188; times[1084] = 1299551; times[1085] = 1311276; times[1086] = 1322105; times[1087] = 1333784; times[1088] = 1343017; times[1089] = 1351512; times[1090] = 1356396; times[1091] = 1359286; times[1092] = 1358317; times[1093] = 1354780; times[1094] = 1348213; times[1095] = 1339371; times[1096] = 1329097; times[1097] = 1317563; times[1098] = 1306467; times[1099] = 1295437; times[1100] = 1286460; times[1101] = 1278748; times[1102] = 1274153; times[1103] = 1271567;
    times[1104] = 1272496; times[1105] = 1275558; times[1106] = 1281877; times[1107] = 1289768; times[1108] = 1300079; times[1109] = 1310755; times[1110] = 1322616; times[1111] = 1333161; times[1112] = 1343544; times[1113] = 1350889; times[1114] = 1356935; times[1115] = 1358791; times[1116] = 1358772; times[1117] = 1354475; times[1118] = 1348484; times[1119] = 1339266; times[1120] = 1329189; times[1121] = 1317613; times[1122] = 1306432; times[1123] = 1295550; times[1124] = 1286346; times[1125] = 1278836; times[1126] = 1273986; times[1127] = 1271583;
    times[1128] = 1272310; times[1129] = 1275531; times[1130] = 1281692; times[1131] = 1289763; times[1132] = 1299882; times[1133] = 1310850; times[1134] = 1322354; times[1135] = 1333415; times[1136] = 1343163; times[1137] = 1351332; times[1138] = 1356455; times[1139] = 1359421; times[1140] = 1358301; times[1141] = 1355202; times[1142] = 1348085; times[1143] = 1339927; times[1144] = 1328852; times[1145] = 1318122; times[1146] = 1306113; times[1147] = 1295912; times[1148] = 1285994; times[1149] = 1279115; times[1150] = 1273592; times[1151] = 1271850;
    times[1152] = 1271889; times[1153] = 1275818; times[1154] = 1281278; times[1155] = 1290075; times[1156] = 1299530; times[1157] = 1311157; times[1158] = 1322130; times[1159] = 1333643; times[1160] = 1343122; times[1161] = 1351364; times[1162] = 1356613; times[1163] = 1359176; times[1164] = 1358641; times[1165] = 1354728; times[1166] = 1348573; times[1167] = 1339349; times[1168] = 1329400; times[1169] = 1317517; times[1170] = 1306661; times[1171] = 1295315; times[1172] = 1286535; times[1173] = 1278530; times[1174] = 1274136; times[1175] = 1271275;
    times[1176] = 1272444; times[1177] = 1275257; times[1178] = 1281854; times[1179] = 1289533; times[1180] = 1300125; times[1181] = 1310635; times[1182] = 1322719; times[1183] = 1333159; times[1184] = 1343644; times[1185] = 1350971; times[1186] = 1356954; times[1187] = 1358932; times[1188] = 1358704; times[1189] = 1354697; times[1190] = 1348395; times[1191] = 1339558; times[1192] = 1329099; times[1193] = 1317914; times[1194] = 1306315; times[1195] = 1295809; times[1196] = 1286176; times[1197] = 1279042; times[1198] = 1273767; times[1199] = 1271752;
    times[1200] = 1272052; times[1201] = 1275671; times[1202] = 1281403; times[1203] = 1289877; times[1204] = 1299580; times[1205] = 1310961; times[1206] = 1322079; times[1207] = 1333535; times[1208] = 1342946; times[1209] = 1351433; times[1210] = 1356300; times[1211] = 1359437; times[1212] = 1358196; times[1213] = 1355118; times[1214] = 1348078; times[1215] = 1339830; times[1216] = 1328993; times[1217] = 1318087; times[1218] = 1306384; times[1219] = 1295940; times[1220] = 1286326; times[1221] = 1279151; times[1222] = 1273898; times[1223] = 1271824;
    times[1224] = 1272100; times[1225] = 1275684; times[1226] = 1281372; times[1227] = 1289822; times[1228] = 1299541; times[1229] = 1310817; times[1230] = 1322125; times[1231] = 1333272; times[1232] = 1343167; times[1233] = 1351030; times[1234] = 1356736; times[1235] = 1358943; times[1236] = 1358806; times[1237] = 1354609; times[1238] = 1348719; times[1239] = 1339325; times[1240] = 1329520; times[1241] = 1317573; times[1242] = 1306777; times[1243] = 1295436; times[1244] = 1286667; times[1245] = 1278675; times[1246] = 1274263; times[1247] = 1271384;
    times[1248] = 1272517; times[1249] = 1275272; times[1250] = 1281826; times[1251] = 1289438; times[1252] = 1299984; times[1253] = 1310480; times[1254] = 1322495; times[1255] = 1333044; times[1256] = 1343388; times[1257] = 1350989; times[1258] = 1356732; times[1259] = 1359128; times[1260] = 1358567; times[1261] = 1355012; times[1262] = 1348310; times[1263] = 1339855; times[1264] = 1328997; times[1265] = 1318126; times[1266] = 1306185; times[1267] = 1295964; times[1268] = 1286042; times[1269] = 1279197; times[1270] = 1273653; times[1271] = 1271936;
    times[1272] = 1271956; times[1273] = 1275875; times[1274] = 1281312; times[1275] = 1290081; times[1276] = 1299484; times[1277] = 1311126; times[1278] = 1321965; times[1279] = 1333617; times[1280] = 1342829; times[1281] = 1351397; times[1282] = 1356229; times[1283] = 1359301; times[1284] = 1358232; times[1285] = 1354949; times[1286] = 1348234; times[1287] = 1339654; times[1288] = 1329189; times[1289] = 1317873; times[1290] = 1306549; times[1291] = 1295683; times[1292] = 1286466; times[1293] = 1278896; times[1294] = 1274066; times[1295] = 1271632;
    times[1296] = 1272344; times[1297] = 1275580; times[1298] = 1281697; times[1299] = 1289774; times[1300] = 1299891; times[1301] = 1310747; times[1302] = 1322422; times[1303] = 1333118; times[1304] = 1343352; times[1305] = 1350807; times[1306] = 1356791; times[1307] = 1358710; times[1308] = 1358744; times[1309] = 1354450; times[1310] = 1348608; times[1311] = 1339319; times[1312] = 1329442; times[1313] = 1317725; times[1314] = 1306741; times[1315] = 1295655; times[1316] = 1286616; times[1317] = 1278859; times[1318] = 1274150; times[1319] = 1271493;
    times[1320] = 1272358; times[1321] = 1275346; times[1322] = 1281669; times[1323] = 1289532; times[1324] = 1299847; times[1325] = 1310620; times[1326] = 1322346; times[1327] = 1333208; times[1328] = 1343181; times[1329] = 1351146; times[1330] = 1356474; times[1331] = 1359273; times[1332] = 1358318; times[1333] = 1355132; times[1334] = 1348131; times[1335] = 1339973; times[1336] = 1328944; times[1337] = 1318278; times[1338] = 1306253; times[1339] = 1296128; times[1340] = 1286142; times[1341] = 1279315; times[1342] = 1273686; times[1343] = 1271965;
    times[1344] = 1271879; times[1345] = 1275819; times[1346] = 1281162; times[1347] = 1289990; times[1348] = 1299348; times[1349] = 1311054; times[1350] = 1321936; times[1351] = 1333593; times[1352] = 1342954; times[1353] = 1351395; times[1354] = 1356474; times[1355] = 1359258; times[1356] = 1358513; times[1357] = 1354820; times[1358] = 1348474; times[1359] = 1339450; times[1360] = 1329366; times[1361] = 1317651; times[1362] = 1306706; times[1363] = 1295495; times[1364] = 1286636; times[1365] = 1278736; times[1366] = 1274241; times[1367] = 1271458;
    times[1368] = 1272490; times[1369] = 1275362; times[1370] = 1281801; times[1371] = 1289529; times[1372] = 1299980; times[1373] = 1310542; times[1374] = 1322543; times[1375] = 1333030; times[1376] = 1343521; times[1377] = 1350860; times[1378] = 1356945; times[1379] = 1358861; times[1380] = 1358799; times[1381] = 1354635; times[1382] = 1348528; times[1383] = 1339480; times[1384] = 1329231; times[1385] = 1317836; times[1386] = 1306452; times[1387] = 1295751; times[1388] = 1286339; times[1389] = 1279016; times[1390] = 1273958; times[1391] = 1271746;
    times[1392] = 1272247; times[1393] = 1275644; times[1394] = 1281555; times[1395] = 1289786; times[1396] = 1299655; times[1397] = 1310794; times[1398] = 1322077; times[1399] = 1333332; times[1400] = 1342910; times[1401] = 1351271; times[1402] = 1356280; times[1403] = 1359394; times[1404] = 1358221; times[1405] = 1355204; times[1406] = 1348123; times[1407] = 1339976; times[1408] = 1329000; times[1409] = 1318219; times[1410] = 1306330; times[1411] = 1296035; times[1412] = 1286233; times[1413] = 1279229; times[1414] = 1273805; times[1415] = 1271918;
    times[1416] = 1272032; times[1417] = 1275800; times[1418] = 1281323; times[1419] = 1289942; times[1420] = 1299474; times[1421] = 1310913; times[1422] = 1322005; times[1423] = 1333335; times[1424] = 1343003; times[1425] = 1351078; times[1426] = 1356581; times[1427] = 1359008; times[1428] = 1358733; times[1429] = 1354719; times[1430] = 1348765; times[1431] = 1339465; times[1432] = 1329630; times[1433] = 1317684; times[1434] = 1306870; times[1435] = 1295465; times[1436] = 1286690; times[1437] = 1278623; times[1438] = 1274222; times[1439] = 1271289;
    times[1440] = 1272455; times[1441] = 1275187; times[1442] = 1281788; times[1443] = 1289389; times[1444] = 1299992; times[1445] = 1310455; times[1446] = 1322538; times[1447] = 1333002; times[1448] = 1343455; times[1449] = 1350906; times[1450] = 1356821; times[1451] = 1359024; times[1452] = 1358686; times[1453] = 1354939; times[1454] = 1348478; times[1455] = 1339860; times[1456] = 1329208; times[1457] = 1318189; times[1458] = 1306390; times[1459] = 1296012; times[1460] = 1286179; times[1461] = 1279164; times[1462] = 1273689; times[1463] = 1271803;
    times[1464] = 1271910; times[1465] = 1275680; times[1466] = 1281241; times[1467] = 1289892; times[1468] = 1299445; times[1469] = 1311003; times[1470] = 1321975; times[1471] = 1333574; times[1472] = 1342858; times[1473] = 1351426; times[1474] = 1356244; times[1475] = 1359391; times[1476] = 1358219; times[1477] = 1355085; times[1478] = 1348211; times[1479] = 1339842; times[1480] = 1329193; times[1481] = 1318111; times[1482] = 1306585; times[1483] = 1295930; times[1484] = 1286489; times[1485] = 1279094; times[1486] = 1274012; times[1487] = 1271730;
    times[1488] = 1272177; times[1489] = 1275567; times[1490] = 1281434; times[1491] = 1289695; times[1492] = 1299602; times[1493] = 1310683; times[1494] = 1322186; times[1495] = 1333128; times[1496] = 1343222; times[1497] = 1350885; times[1498] = 1356770; times[1499] = 1358820; times[1500] = 1358811; times[1501] = 1354544; times[1502] = 1348727; times[1503] = 1339373; times[1504] = 1329591; times[1505] = 1317762; times[1506] = 1306926; times[1507] = 1295695; times[1508] = 1286816; times[1509] = 1278889; times[1510] = 1274315; times[1511] = 1271472;
    times[1512] = 1272445; times[1513] = 1275233; times[1514] = 1281650; times[1515] = 1289315; times[1516] = 1299750; times[1517] = 1310340; times[1518] = 1322248; times[1519] = 1332950; times[1520] = 1343170; times[1521] = 1350979; times[1522] = 1356574; times[1523] = 1359217; times[1524] = 1358494; times[1525] = 1355173; times[1526] = 1348325; times[1527] = 1340061; times[1528] = 1329097; times[1529] = 1318367; times[1530] = 1306354; times[1531] = 1296211; times[1532] = 1286221; times[1533] = 1279396; times[1534] = 1273756; times[1535] = 1272028;
    times[1536] = 1271923; times[1537] = 1275832; times[1538] = 1281142; times[1539] = 1289922; times[1540] = 1299231; times[1541] = 1310910; times[1542] = 1321728; times[1543] = 1333433; times[1544] = 1342724; times[1545] = 1351318; times[1546] = 1356304; times[1547] = 1359320; times[1548] = 1358436; times[1549] = 1355006; times[1550] = 1348492; times[1551] = 1339705; times[1552] = 1329432; times[1553] = 1317892; times[1554] = 1306750; times[1555] = 1295666; times[1556] = 1286627; times[1557] = 1278850; times[1558] = 1274188; times[1559] = 1271546;
    times[1560] = 1272414; times[1561] = 1275435; times[1562] = 1281702; times[1563] = 1289570; times[1564] = 1299846; times[1565] = 1310519; times[1566] = 1322360; times[1567] = 1332929; times[1568] = 1343321; times[1569] = 1350713; times[1570] = 1356814; times[1571] = 1358742; times[1572] = 1358807; times[1573] = 1354587; times[1574] = 1348684; times[1575] = 1339510; times[1576] = 1329487; times[1577] = 1317910; times[1578] = 1306728; times[1579] = 1295797; times[1580] = 1286556; times[1581] = 1278984; times[1582] = 1274091; times[1583] = 1271637;
    times[1584] = 1272319; times[1585] = 1275489; times[1586] = 1281599; times[1587] = 1289614; times[1588] = 1299693; times[1589] = 1310615; times[1590] = 1322101; times[1591] = 1333136; times[1592] = 1342895; times[1593] = 1351056; times[1594] = 1356224; times[1595] = 1359218; times[1596] = 1358171; times[1597] = 1355146; times[1598] = 1348126; times[1599] = 1340059; times[1600] = 1329067; times[1601] = 1318415; times[1602] = 1306442; times[1603] = 1296270; times[1604] = 1286330; times[1605] = 1279420; times[1606] = 1273823; times[1607] = 1272011;
    times[1608] = 1271951; times[1609] = 1275799; times[1610] = 1281169; times[1611] = 1289895; times[1612] = 1299293; times[1613] = 1310875; times[1614] = 1321826; times[1615] = 1333339; times[1616] = 1342826; times[1617] = 1351106; times[1618] = 1356391; times[1619] = 1359030; times[1620] = 1358550; times[1621] = 1354742; times[1622] = 1348653; times[1623] = 1339518; times[1624] = 1329619; times[1625] = 1317790; times[1626] = 1306953; times[1627] = 1295619; times[1628] = 1286823; times[1629] = 1278782; times[1630] = 1274329; times[1631] = 1271393;
    times[1632] = 1272476; times[1633] = 1275197; times[1634] = 1281710; times[1635] = 1289312; times[1636] = 1299856; times[1637] = 1310332; times[1638] = 1322414; times[1639] = 1332880; times[1640] = 1343403; times[1641] = 1350795; times[1642] = 1356851; times[1643] = 1358901; times[1644] = 1358746; times[1645] = 1354788; times[1646] = 1348540; times[1647] = 1339713; times[1648] = 1329286; times[1649] = 1318093; times[1650] = 1306511; times[1651] = 1295983; times[1652] = 1286354; times[1653] = 1279184; times[1654] = 1273890; times[1655] = 1271823;
    times[1656] = 1272082; times[1657] = 1275642; times[1658] = 1281336; times[1659] = 1289766; times[1660] = 1299450; times[1661] = 1310807; times[1662] = 1321920; times[1663] = 1333376; times[1664] = 1342795; times[1665] = 1351307; times[1666] = 1356212; times[1667] = 1359390; times[1668] = 1358197; times[1669] = 1355158; times[1670] = 1348154; times[1671] = 1339925; times[1672] = 1329088; times[1673] = 1318187; times[1674] = 1306462; times[1675] = 1296018; times[1676] = 1286384; times[1677] = 1279214; times[1678] = 1273943; times[1679] = 1271878;
    times[1680] = 1272128; times[1681] = 1275715; times[1682] = 1281364; times[1683] = 1289801; times[1684] = 1299472; times[1685] = 1310725; times[1686] = 1321992; times[1687] = 1333131; times[1688] = 1343012; times[1689] = 1350894; times[1690] = 1356625; times[1691] = 1358873; times[1692] = 1358781; times[1693] = 1354634; times[1694] = 1348787; times[1695] = 1339440; times[1696] = 1329666; times[1697] = 1317753; times[1698] = 1306962; times[1699] = 1295609; times[1700] = 1286809; times[1701] = 1278767; times[1702] = 1274301; times[1703] = 1271366;
    times[1704] = 1272453; times[1705] = 1275166; times[1706] = 1281690; times[1707] = 1289269; times[1708] = 1299802; times[1709] = 1310274; times[1710] = 1322293; times[1711] = 1332835; times[1712] = 1343211; times[1713] = 1350832; times[1714] = 1356643; times[1715] = 1359093; times[1716] = 1358616; times[1717] = 1355129; times[1718] = 1348502; times[1719] = 1340098; times[1720] = 1329280; times[1721] = 1318422; times[1722] = 1306474; times[1723] = 1296209; times[1724] = 1286239; times[1725] = 1279306; times[1726] = 1273691; times[1727] = 1271877;
    times[1728] = 1271829; times[1729] = 1275674; times[1730] = 1281070; times[1731] = 1289801; times[1732] = 1299201; times[1733] = 1310845; times[1734] = 1321719; times[1735] = 1333421; times[1736] = 1342699; times[1737] = 1351350; times[1738] = 1356251; times[1739] = 1359403; times[1740] = 1358377; times[1741] = 1355159; times[1742] = 1348472; times[1743] = 1339925; times[1744] = 1329459; times[1745] = 1318140; times[1746] = 1306782; times[1747] = 1295876; times[1748] = 1286598; times[1749] = 1278961; times[1750] = 1274051; times[1751] = 1271546;
    times[1752] = 1272173; times[1753] = 1275360; times[1754] = 1281417; times[1755] = 1289487; times[1756] = 1299590; times[1757] = 1310487; times[1758] = 1322188; times[1759] = 1332962; times[1760] = 1343246; times[1761] = 1350781; times[1762] = 1356824; times[1763] = 1358807; times[1764] = 1358891; times[1765] = 1354636; times[1766] = 1348839; times[1767] = 1339557; times[1768] = 1329702; times[1769] = 1317969; times[1770] = 1306974; times[1771] = 1295849; times[1772] = 1286782; times[1773] = 1278983; times[1774] = 1274238; times[1775] = 1271534;
    times[1776] = 1272345; times[1777] = 1275265; times[1778] = 1281516; times[1779] = 1289305; times[1780] = 1299572; times[1781] = 1310302; times[1782] = 1322031; times[1783] = 1332901; times[1784] = 1342930; times[1785] = 1350937; times[1786] = 1356357; times[1787] = 1359210; times[1788] = 1358344; times[1789] = 1355220; times[1790] = 1348290; times[1791] = 1340184; times[1792] = 1329202; times[1793] = 1318573; times[1794] = 1306557; times[1795] = 1296442; times[1796] = 1286429; times[1797] = 1279570; times[1798] = 1273879; times[1799] = 1272094;
    times[1800] = 1271924; times[1801] = 1275778; times[1802] = 1281029; times[1803] = 1289766; times[1804] = 1299052; times[1805] = 1310691; times[1806] = 1321542; times[1807] = 1333199; times[1808] = 1342589; times[1809] = 1351101; times[1810] = 1356264; times[1811] = 1359179; times[1812] = 1358540; times[1813] = 1354989; times[1814] = 1348724; times[1815] = 1339780; times[1816] = 1329715; times[1817] = 1318012; times[1818] = 1307037; times[1819] = 1295795; times[1820] = 1286886; times[1821] = 1278927; times[1822] = 1274364; times[1823] = 1271509;
    times[1824] = 1272464; times[1825] = 1275262; times[1826] = 1281627; times[1827] = 1289291; times[1828] = 1299690; times[1829] = 1310211; times[1830] = 1322189; times[1831] = 1332688; times[1832] = 1343200; times[1833] = 1350609; times[1834] = 1356778; times[1835] = 1358799; times[1836] = 1358856; times[1837] = 1354795; times[1838] = 1348794; times[1839] = 1339797; times[1840] = 1329599; times[1841] = 1318192; times[1842] = 1306798; times[1843] = 1296033; times[1844] = 1286574; times[1845] = 1279168; times[1846] = 1274050; times[1847] = 1271757;
    times[1848] = 1272202; times[1849] = 1275540; times[1850] = 1281420; times[1851] = 1289624; times[1852] = 1299486; times[1853] = 1310609; times[1854] = 1321888; times[1855] = 1333128; times[1856] = 1342700; times[1857] = 1351061; times[1858] = 1356103; times[1859] = 1359248; times[1860] = 1358146; times[1861] = 1355196; times[1862] = 1348200; times[1863] = 1340127; times[1864] = 1329212; times[1865] = 1318483; times[1866] = 1306603; times[1867] = 1296310; times[1868] = 1286470; times[1869] = 1279430; times[1870] = 1273939; times[1871] = 1272004;
    times[1872] = 1272047; times[1873] = 1275778; times[1874] = 1281240; times[1875] = 1289834; times[1876] = 1299323; times[1877] = 1310746; times[1878] = 1321812; times[1879] = 1333140; times[1880] = 1342794; times[1881] = 1350879; times[1882] = 1356388; times[1883] = 1358844; times[1884] = 1358597; times[1885] = 1354646; times[1886] = 1348746; times[1887] = 1339538; times[1888] = 1329780; times[1889] = 1317930; times[1890] = 1307175; times[1891] = 1295812; times[1892] = 1287035; times[1893] = 1278925; times[1894] = 1274456; times[1895] = 1271436;
    times[1896] = 1272503; times[1897] = 1275142; times[1898] = 1281655; times[1899] = 1289185; times[1900] = 1299737; times[1901] = 1310162; times[1902] = 1322244; times[1903] = 1332709; times[1904] = 1343200; times[1905] = 1350681; times[1906] = 1356658; times[1907] = 1358908; times[1908] = 1358635; times[1909] = 1354941; times[1910] = 1348550; times[1911] = 1339982; times[1912] = 1329397; times[1913] = 1318420; times[1914] = 1306668; times[1915] = 1296297; times[1916] = 1286479; times[1917] = 1279422; times[1918] = 1273917; times[1919] = 1271948;
    times[1920] = 1271984; times[1921] = 1275651; times[1922] = 1281130; times[1923] = 1289691; times[1924] = 1299191; times[1925] = 1310702; times[1926] = 1321679; times[1927] = 1333307; times[1928] = 1342654; times[1929] = 1351302; times[1930] = 1356196; times[1931] = 1359416; times[1932] = 1358283; times[1933] = 1355191; times[1934] = 1348328; times[1935] = 1339969; times[1936] = 1329313; times[1937] = 1318234; times[1938] = 1306696; times[1939] = 1296043; times[1940] = 1286590; times[1941] = 1279192; times[1942] = 1274089; times[1943] = 1271794;
    times[1944] = 1272200; times[1945] = 1275565; times[1946] = 1281375; times[1947] = 1289609; times[1948] = 1299462; times[1949] = 1310533; times[1950] = 1322009; times[1951] = 1332976; times[1952] = 1343078; times[1953] = 1350794; times[1954] = 1356721; times[1955] = 1358832; times[1956] = 1358871; times[1957] = 1354646; times[1958] = 1348861; times[1959] = 1339503; times[1960] = 1329718; times[1961] = 1317861; times[1962] = 1306997; times[1963] = 1295740; times[1964] = 1286847; times[1965] = 1278919; times[1966] = 1274356; times[1967] = 1271524;
    times[1968] = 1272498; times[1969] = 1275275; times[1970] = 1281663; times[1971] = 1289283; times[1972] = 1299676; times[1973] = 1310211; times[1974] = 1322086; times[1975] = 1332752; times[1976] = 1342974; times[1977] = 1350780; times[1978] = 1356426; times[1979] = 1359096; times[1980] = 1358448; times[1981] = 1355182; times[1982] = 1348408; times[1983] = 1340190; times[1984] = 1329268; times[1985] = 1318558; times[1986] = 1306538; times[1987] = 1296379; times[1988] = 1286352; times[1989] = 1279487; times[1990] = 1273804; times[1991] = 1272033;
    times[1992] = 1271894; times[1993] = 1275766; times[1994] = 1281052; times[1995] = 1289798; times[1996] = 1299092; times[1997] = 1310739; times[1998] = 1321546; times[1999] = 1333242; times[2000] = 1342535; times[2001] = 1351156; times[2002] = 1356179; times[2003] = 1359272; times[2004] = 1358454; times[2005] = 1355130; times[2006] = 1348672; times[2007] = 1339954; times[2008] = 1329694; times[2009] = 1318167; times[2010] = 1306993; times[2011] = 1295875; times[2012] = 1286768; times[2013] = 1278920; times[2014] = 1274175; times[2015] = 1271456;
    times[2016] = 1272251; times[2017] = 1275222; times[2018] = 1281449; times[2019] = 1289306; times[2020] = 1299580; times[2021] = 1310281; times[2022] = 1322146; times[2023] = 1332771; times[2024] = 1343199; times[2025] = 1350661; times[2026] = 1356817; times[2027] = 1358812; times[2028] = 1358946; times[2029] = 1354781; times[2030] = 1348937; times[2031] = 1339780; times[2032] = 1329783; times[2033] = 1318182; times[2034] = 1306984; times[2035] = 1295993; times[2036] = 1286706; times[2037] = 1279045; times[2038] = 1274085; times[2039] = 1271537;
    times[2040] = 1272148; times[2041] = 1275254; times[2042] = 1281334; times[2043] = 1289340; times[2044] = 1299442; times[2045] = 1310392; times[2046] = 1321931; times[2047] = 1333006; times[2048] = 1342823; times[2049] = 1351021; times[2050] = 1356251; times[2051] = 1359268; times[2052] = 1358271; times[2053] = 1355270; times[2054] = 1348285; times[2055] = 1340240; times[2056] = 1329266; times[2057] = 1318626; times[2058] = 1306639; times[2059] = 1296457; times[2060] = 1286477; times[2061] = 1279535; times[2062] = 1273879; times[2063] = 1272022;
    times[2064] = 1271890; times[2065] = 1275690; times[2066] = 1280989; times[2067] = 1289677; times[2068] = 1299033; times[2069] = 1310606; times[2070] = 1321561; times[2071] = 1333108; times[2072] = 1342639; times[2073] = 1350988; times[2074] = 1356334; times[2075] = 1359048; times[2076] = 1358618; times[2077] = 1354873; times[2078] = 1348811; times[2079] = 1339730; times[2080] = 1329855; times[2081] = 1318073; times[2082] = 1307246; times[2083] = 1295918; times[2084] = 1287091; times[2085] = 1278996; times[2086] = 1274471; times[2087] = 1271453;
    times[2088] = 1272443; times[2089] = 1275077; times[2090] = 1281497; times[2091] = 1289020; times[2092] = 1299501; times[2093] = 1309930; times[2094] = 1322004; times[2095] = 1332483; times[2096] = 1343066; times[2097] = 1350537; times[2098] = 1356707; times[2099] = 1358874; times[2100] = 1358843; times[2101] = 1354991; times[2102] = 1348837; times[2103] = 1340057; times[2104] = 1329669; times[2105] = 1318464; times[2106] = 1306872; times[2107] = 1296288; times[2108] = 1286623; times[2109] = 1279369; times[2110] = 1274020; times[2111] = 1271858;
    times[2112] = 1272047; times[2113] = 1275512; times[2114] = 1281138; times[2115] = 1289485; times[2116] = 1299123; times[2117] = 1310429; times[2118] = 1321543; times[2119] = 1333016; times[2120] = 1342497; times[2121] = 1351093; times[2122] = 1356098; times[2123] = 1359383; times[2124] = 1358291; times[2125] = 1355350; times[2126] = 1348425; times[2127] = 1340251; times[2128] = 1329439; times[2129] = 1318540; times[2130] = 1306776; times[2131] = 1296289; times[2132] = 1286584; times[2133] = 1279349; times[2134] = 1274005; times[2135] = 1271882;
    times[2136] = 1272064; times[2137] = 1275610; times[2138] = 1281201; times[2139] = 1289618; times[2140] = 1299247; times[2141] = 1310499; times[2142] = 1321742; times[2143] = 1332899; times[2144] = 1342777; times[2145] = 1350701; times[2146] = 1356467; times[2147] = 1358785; times[2148] = 1358763; times[2149] = 1354704; times[2150] = 1348941; times[2151] = 1339660; times[2152] = 1329944; times[2153] = 1318062; times[2154] = 1307269; times[2155] = 1295904; times[2156] = 1287065; times[2157] = 1278980; times[2158] = 1274463; times[2159] = 1271474;
    times[2160] = 1272499; times[2161] = 1275147; times[2162] = 1281601; times[2163] = 1289117; times[2164] = 1299597; times[2165] = 1310021; times[2166] = 1322016; times[2167] = 1332534; times[2168] = 1342917; times[2169] = 1350535; times[2170] = 1356388; times[2171] = 1358862; times[2172] = 1358462; times[2173] = 1355042; times[2174] = 1348517; times[2175] = 1340199; times[2176] = 1329481; times[2177] = 1318700; times[2178] = 1306807; times[2179] = 1296574; times[2180] = 1286605; times[2181] = 1279635; times[2182] = 1273969; times[2183] = 1272068;
    times[2184] = 1271938; times[2185] = 1275679; times[2186] = 1280996; times[2187] = 1289635; times[2188] = 1298981; times[2189] = 1310566; times[2190] = 1321421; times[2191] = 1333110; times[2192] = 1342401; times[2193] = 1351083; times[2194] = 1356030; times[2195] = 1359252; times[2196] = 1358289; times[2197] = 1355167; times[2198] = 1348536; times[2199] = 1340070; times[2200] = 1329645; times[2201] = 1318381; times[2202] = 1307043; times[2203] = 1296160; times[2204] = 1286875; times[2205] = 1279215; times[2206] = 1274258; times[2207] = 1271693;
    times[2208] = 1272238; times[2209] = 1275348; times[2210] = 1281313; times[2211] = 1289318; times[2212] = 1299356; times[2213] = 1310224; times[2214] = 1321905; times[2215] = 1332707; times[2216] = 1343008; times[2217] = 1350611; times[2218] = 1356709; times[2219] = 1358767; times[2220] = 1358914; times[2221] = 1354715; times[2222] = 1348962; times[2223] = 1339694; times[2224] = 1329866; times[2225] = 1318123; times[2226] = 1307138; times[2227] = 1295995; times[2228] = 1286929; times[2229] = 1279101; times[2230] = 1274341; times[2231] = 1271598;
    times[2232] = 1272378; times[2233] = 1275260; times[2234] = 1281481; times[2235] = 1289242; times[2236] = 1299487; times[2237] = 1310192; times[2238] = 1321910; times[2239] = 1332762; times[2240] = 1342800; times[2241] = 1350810; times[2242] = 1356271; times[2243] = 1359138; times[2244] = 1358327; times[2245] = 1355229; times[2246] = 1348340; times[2247] = 1340249; times[2248] = 1329283; times[2249] = 1318652; times[2250] = 1306626; times[2251] = 1296505; times[2252] = 1286478; times[2253] = 1279618; times[2254] = 1273919; times[2255] = 1272139;
    times[2256] = 1271957; times[2257] = 1275812; times[2258] = 1281042; times[2259] = 1289764; times[2260] = 1299019; times[2261] = 1310627; times[2262] = 1321452; times[2263] = 1333085; times[2264] = 1342463; times[2265] = 1350984; times[2266] = 1356160; times[2267] = 1359110; times[2268] = 1358498; times[2269] = 1355002; times[2270] = 1348763; times[2271] = 1339882; times[2272] = 1329846; times[2273] = 1318192; times[2274] = 1307216; times[2275] = 1295975; times[2276] = 1287022; times[2277] = 1279015; times[2278] = 1274390; times[2279] = 1271482;
    times[2280] = 1272382; times[2281] = 1275144; times[2282] = 1281473; times[2283] = 1289120; times[2284] = 1299503; times[2285] = 1310019; times[2286] = 1322003; times[2287] = 1332514; times[2288] = 1343048; times[2289] = 1350497; times[2290] = 1356714; times[2291] = 1358798; times[2292] = 1358920; times[2293] = 1354924; times[2294] = 1348986; times[2295] = 1340024; times[2296] = 1329866; times[2297] = 1318452; times[2298] = 1307059; times[2299] = 1296244; times[2300] = 1286748; times[2301] = 1279252; times[2302] = 1274072; times[2303] = 1271680;
    times[2304] = 1272063; times[2305] = 1275324; times[2306] = 1281169; times[2307] = 1289336; times[2308] = 1299205; times[2309] = 1310337; times[2310] = 1321672; times[2311] = 1332969; times[2312] = 1342624; times[2313] = 1351061; times[2314] = 1356177; times[2315] = 1359376; times[2316] = 1358322; times[2317] = 1355407; times[2318] = 1348441; times[2319] = 1340375; times[2320] = 1329461; times[2321] = 1318716; times[2322] = 1306800; times[2323] = 1296471; times[2324] = 1286571; times[2325] = 1279476; times[2326] = 1273913; times[2327] = 1271915;
    times[2328] = 1271883; times[2329] = 1275566; times[2330] = 1280972; times[2331] = 1289558; times[2332] = 1299033; times[2333] = 1310496; times[2334] = 1321593; times[2335] = 1332997; times[2336] = 1342707; times[2337] = 1350878; times[2338] = 1356445; times[2339] = 1358967; times[2340] = 1358763; times[2341] = 1354852; times[2342] = 1348973; times[2343] = 1339778; times[2344] = 1330018; times[2345] = 1318163; times[2346] = 1307375; times[2347] = 1295993; times[2348] = 1287175; times[2349] = 1279039; times[2350] = 1274530; times[2351] = 1271467;
    times[2352] = 1272475; times[2353] = 1275048; times[2354] = 1281481; times[2355] = 1288942; times[2356] = 1299437; times[2357] = 1309825; times[2358] = 1321906; times[2359] = 1332387; times[2360] = 1342936; times[2361] = 1350476; times[2362] = 1356552; times[2363] = 1358871; times[2364] = 1358697; times[2365] = 1355068; times[2366] = 1348746; times[2367] = 1340219; times[2368] = 1329676; times[2369] = 1318714; times[2370] = 1306970; times[2371] = 1296588; times[2372] = 1286749; times[2373] = 1279643; times[2374] = 1274092; times[2375] = 1272042;
    times[2376] = 1272012; times[2377] = 1275582; times[2378] = 1280987; times[2379] = 1289452; times[2380] = 1298888; times[2381] = 1310327; times[2382] = 1321283; times[2383] = 1332900; times[2384] = 1342285; times[2385] = 1351002; times[2386] = 1356000; times[2387] = 1359352; times[2388] = 1358347; times[2389] = 1355400; times[2390] = 1348619; times[2391] = 1340334; times[2392] = 1329692; times[2393] = 1318610; times[2394] = 1307033; times[2395] = 1296337; times[2396] = 1286819; times[2397] = 1279357; times[2398] = 1274181; times[2399] = 1271814;
    times[2400] = 1272141; times[2401] = 1275441; times[2402] = 1281174; times[2403] = 1289362; times[2404] = 1299155; times[2405] = 1310203; times[2406] = 1321652; times[2407] = 1332640; times[2408] = 1342754; times[2409] = 1350550; times[2410] = 1356549; times[2411] = 1358773; times[2412] = 1358925; times[2413] = 1354818; times[2414] = 1349132; times[2415] = 1339839; times[2416] = 1330105; times[2417] = 1318238; times[2418] = 1307355; times[2419] = 1296036; times[2420] = 1287076; times[2421] = 1279062; times[2422] = 1274424; times[2423] = 1271510;
    times[2424] = 1272422; times[2425] = 1275151; times[2426] = 1281507; times[2427] = 1289112; times[2428] = 1299496; times[2429] = 1310018; times[2430] = 1321891; times[2431] = 1332537; times[2432] = 1342762; times[2433] = 1350563; times[2434] = 1356248; times[2435] = 1358939; times[2436] = 1358372; times[2437] = 1355167; times[2438] = 1348487; times[2439] = 1340343; times[2440] = 1329497; times[2441] = 1318833; times[2442] = 1306835; times[2443] = 1296676; times[2444] = 1286616; times[2445] = 1279705; times[2446] = 1273957; times[2447] = 1272120;
    times[2448] = 1271911; times[2449] = 1275724; times[2450] = 1280953; times[2451] = 1289655; times[2452] = 1298914; times[2453] = 1310530; times[2454] = 1321331; times[2455] = 1333010; times[2456] = 1342308; times[2457] = 1350940; times[2458] = 1355978; times[2459] = 1359107; times[2460] = 1358320; times[2461] = 1355067; times[2462] = 1348660; times[2463] = 1340044; times[2464] = 1329861; times[2465] = 1318435; times[2466] = 1307311; times[2467] = 1296240; times[2468] = 1287115; times[2469] = 1279230; times[2470] = 1274408; times[2471] = 1271601;
    times[2472] = 1272292; times[2473] = 1275165; times[2474] = 1281293; times[2475] = 1289079; times[2476] = 1299294; times[2477] = 1309963; times[2478] = 1321819; times[2479] = 1332461; times[2480] = 1342916; times[2481] = 1350438; times[2482] = 1356645; times[2483] = 1358711; times[2484] = 1358909; times[2485] = 1354810; times[2486] = 1349032; times[2487] = 1339924; times[2488] = 1329995; times[2489] = 1318424; times[2490] = 1307274; times[2491] = 1296284; times[2492] = 1287010; times[2493] = 1279308; times[2494] = 1274319; times[2495] = 1271685;
    times[2496] = 1272229; times[2497] = 1275231; times[2498] = 1281226; times[2499] = 1289139; times[2500] = 1299180; times[2501] = 1310081; times[2502] = 1321626; times[2503] = 1332723; times[2504] = 1342604; times[2505] = 1350874; times[2506] = 1356185; times[2507] = 1359265; times[2508] = 1358333; times[2509] = 1355367; times[2510] = 1348419; times[2511] = 1340380; times[2512] = 1329415; times[2513] = 1318768; times[2514] = 1306771; times[2515] = 1296584; times[2516] = 1286587; times[2517] = 1279637; times[2518] = 1273959; times[2519] = 1272083;
    times[2520] = 1271915; times[2521] = 1275688; times[2522] = 1280935; times[2523] = 1289593; times[2524] = 1298896; times[2525] = 1310451; times[2526] = 1321378; times[2527] = 1332935; times[2528] = 1342474; times[2529] = 1350868; times[2530] = 1356255; times[2531] = 1359027; times[2532] = 1358648; times[2533] = 1354959; times[2534] = 1348926; times[2535] = 1339873; times[2536] = 1329991; times[2537] = 1318207; times[2538] = 1307342; times[2539] = 1296006; times[2540] = 1287152; times[2541] = 1279063; times[2542] = 1274535; times[2543] = 1271521;
    times[2544] = 1272501; times[2545] = 1275118; times[2546] = 1281498; times[2547] = 1288986; times[2548] = 1299414; times[2549] = 1309797; times[2550] = 1321832; times[2551] = 1332276; times[2552] = 1342854; times[2553] = 1350326; times[2554] = 1356532; times[2555] = 1358736; times[2556] = 1358775; times[2557] = 1354985; times[2558] = 1348907; times[2559] = 1340187; times[2560] = 1329861; times[2561] = 1318681; times[2562] = 1307105; times[2563] = 1296503; times[2564] = 1286814; times[2565] = 1279504; times[2566] = 1274116; times[2567] = 1271885;
    times[2568] = 1272039; times[2569] = 1275443; times[2570] = 1281044; times[2571] = 1289343; times[2572] = 1298966; times[2573] = 1310234; times[2574] = 1321346; times[2575] = 1332798; times[2576] = 1342293; times[2577] = 1350908; times[2578] = 1355962; times[2579] = 1359318; times[2580] = 1358306; times[2581] = 1355464; times[2582] = 1348603; times[2583] = 1340491; times[2584] = 1329705; times[2585] = 1318816; times[2586] = 1307034; times[2587] = 1296518; times[2588] = 1286752; times[2589] = 1279451; times[2590] = 1274024; times[2591] = 1271822;
    times[2592] = 1271921; times[2593] = 1275413; times[2594] = 1280949; times[2595] = 1289355; times[2596] = 1298969; times[2597] = 1310254; times[2598] = 1321517; times[2599] = 1332737; times[2600] = 1342648; times[2601] = 1350650; times[2602] = 1356458; times[2603] = 1358848; times[2604] = 1358878; times[2605] = 1354883; times[2606] = 1349164; times[2607] = 1339914; times[2608] = 1330221; times[2609] = 1318328; times[2610] = 1307521; times[2611] = 1296115; times[2612] = 1287226; times[2613] = 1279078; times[2614] = 1274488; times[2615] = 1271422;
    times[2616] = 1272373; times[2617] = 1274967; times[2618] = 1281379; times[2619] = 1288885; times[2620] = 1299367; times[2621] = 1309808; times[2622] = 1321839; times[2623] = 1332384; times[2624] = 1342821; times[2625] = 1350473; times[2626] = 1356387; times[2627] = 1358879; times[2628] = 1358533; times[2629] = 1355127; times[2630] = 1348644; times[2631] = 1340343; times[2632] = 1329659; times[2633] = 1318888; times[2634] = 1307005; times[2635] = 1296767; times[2636] = 1286778; times[2637] = 1279781; times[2638] = 1274073; times[2639] = 1272119;
    times[2640] = 1271935; times[2641] = 1275610; times[2642] = 1280866; times[2643] = 1289444; times[2644] = 1298751; times[2645] = 1310297; times[2646] = 1321159; times[2647] = 1332853; times[2648] = 1342192; times[2649] = 1350930; times[2650] = 1355941; times[2651] = 1359239; times[2652] = 1358329; times[2653] = 1355275; times[2654] = 1348670; times[2655] = 1340263; times[2656] = 1329862; times[2657] = 1318647; times[2658] = 1307315; times[2659] = 1296445; times[2660] = 1287124; times[2661] = 1279429; times[2662] = 1274405; times[2663] = 1271770;
    times[2664] = 1272235; times[2665] = 1275264; times[2666] = 1281143; times[2667] = 1289079; times[2668] = 1299046; times[2669] = 1309874; times[2670] = 1321528; times[2671] = 1332346; times[2672] = 1342678; times[2673] = 1350370; times[2674] = 1356549; times[2675] = 1358731; times[2676] = 1358988; times[2677] = 1354898; times[2678] = 1349232; times[2679] = 1340015; times[2680] = 1330224; times[2681] = 1318468; times[2682] = 1307473; times[2683] = 1296277; times[2684] = 1287173; times[2685] = 1279271; times[2686] = 1274462; times[2687] = 1271633;
    times[2688] = 1272355; times[2689] = 1275154; times[2690] = 1281312; times[2691] = 1289007; times[2692] = 1299203; times[2693] = 1309871; times[2694] = 1321588; times[2695] = 1332456; times[2696] = 1342551; times[2697] = 1350622; times[2698] = 1356175; times[2699] = 1359115; times[2700] = 1358408; times[2701] = 1355381; times[2702] = 1348578; times[2703] = 1340530; times[2704] = 1329599; times[2705] = 1318963; times[2706] = 1306911; times[2707] = 1296743; times[2708] = 1286651; times[2709] = 1279728; times[2710] = 1273960; times[2711] = 1272122;
    times[2712] = 1271885; times[2713] = 1275703; times[2714] = 1280890; times[2715] = 1289596; times[2716] = 1298824; times[2717] = 1310432; times[2718] = 1321251; times[2719] = 1332891; times[2720] = 1342281; times[2721] = 1350829; times[2722] = 1356037; times[2723] = 1359040; times[2724] = 1358482; times[2725] = 1355063; times[2726] = 1348880; times[2727] = 1340075; times[2728] = 1330072; times[2729] = 1318461; times[2730] = 1307479; times[2731] = 1296244; times[2732] = 1287254; times[2733] = 1279225; times[2734] = 1274548; times[2735] = 1271591;
    times[2736] = 1272424; times[2737] = 1275121; times[2738] = 1281374; times[2739] = 1288966; times[2740] = 1299291; times[2741] = 1309773; times[2742] = 1321733; times[2743] = 1332233; times[2744] = 1342777; times[2745] = 1350240; times[2746] = 1356491; times[2747] = 1358612; times[2748] = 1358796; times[2749] = 1354867; times[2750] = 1349010; times[2751] = 1340127; times[2752] = 1330059; times[2753] = 1318705; times[2754] = 1307374; times[2755] = 1296577; times[2756] = 1287091; times[2757] = 1279554; times[2758] = 1274336; times[2759] = 1271851;
    times[2760] = 1272162; times[2761] = 1275313; times[2762] = 1281080; times[2763] = 1289152; times[2764] = 1298968; times[2765] = 1310040; times[2766] = 1321363; times[2767] = 1332645; times[2768] = 1342330; times[2769] = 1350804; times[2770] = 1355984; times[2771] = 1359261; times[2772] = 1358291; times[2773] = 1355458; times[2774] = 1348552; times[2775] = 1340538; times[2776] = 1329658; times[2777] = 1318936; times[2778] = 1307034; times[2779] = 1296715; times[2780] = 1286799; times[2781] = 1279684; times[2782] = 1274076; times[2783] = 1272026;
    times[2784] = 1271923; times[2785] = 1275536; times[2786] = 1280861; times[2787] = 1289389; times[2788] = 1298798; times[2789] = 1310241; times[2790] = 1321314; times[2791] = 1332747; times[2792] = 1342476; times[2793] = 1350722; times[2794] = 1356341; times[2795] = 1358949; times[2796] = 1358812; times[2797] = 1354968; times[2798] = 1349128; times[2799] = 1339956; times[2800] = 1330203; times[2801] = 1318335; times[2802] = 1307530; times[2803] = 1296128; times[2804] = 1287282; times[2805] = 1279125; times[2806] = 1274582; times[2807] = 1271495;
    times[2808] = 1272471; times[2809] = 1275028; times[2810] = 1281435; times[2811] = 1288884; times[2812] = 1299355; times[2813] = 1309721; times[2814] = 1321782; times[2815] = 1332241; times[2816] = 1342794; times[2817] = 1350340; times[2818] = 1356453; times[2819] = 1358792; times[2820] = 1358680; times[2821] = 1355080; times[2822] = 1348811; times[2823] = 1340305; times[2824] = 1329790; times[2825] = 1318821; times[2826] = 1307071; times[2827] = 1296669; times[2828] = 1286809; times[2829] = 1279681; times[2830] = 1274118; times[2831] = 1272048;
    times[2832] = 1272017; times[2833] = 1275567; times[2834] = 1280972; times[2835] = 1289409; times[2836] = 1298838; times[2837] = 1310239; times[2838] = 1321186; times[2839] = 1332769; times[2840] = 1342155; times[2841] = 1350871; times[2842] = 1355888; times[2843] = 1359275; times[2844] = 1358309; times[2845] = 1355418; times[2846] = 1348676; times[2847] = 1340467; times[2848] = 1329864; times[2849] = 1318836; times[2850] = 1307261; times[2851] = 1296561; times[2852] = 1286985; times[2853] = 1279464; times[2854] = 1274210; times[2855] = 1271774;
    times[2856] = 1272035; times[2857] = 1275287; times[2858] = 1280977; times[2859] = 1289148; times[2860] = 1298921; times[2861] = 1309981; times[2862] = 1321429; times[2863] = 1332450; times[2864] = 1342581; times[2865] = 1350437; times[2866] = 1356471; times[2867] = 1358776; times[2868] = 1358991; times[2869] = 1354961; times[2870] = 1349336; times[2871] = 1340093; times[2872] = 1330396; times[2873] = 1318530; times[2874] = 1307645; times[2875] = 1296278; times[2876] = 1287273; times[2877] = 1279173; times[2878] = 1274457; times[2879] = 1271441;
    times[2880] = 1272274; times[2881] = 1274919; times[2882] = 1281221; times[2883] = 1288791; times[2884] = 1299165; times[2885] = 1309713; times[2886] = 1321639; times[2887] = 1332355; times[2888] = 1342673; times[2889] = 1350549; times[2890] = 1356315; times[2891] = 1359047; times[2892] = 1358544; times[2893] = 1355359; times[2894] = 1348725; times[2895] = 1340586; times[2896] = 1329758; times[2897] = 1319075; times[2898] = 1307058; times[2899] = 1296861; times[2900] = 1286752; times[2901] = 1279783; times[2902] = 1273971; times[2903] = 1272065;
    times[2904] = 1271785; times[2905] = 1275537; times[2906] = 1280710; times[2907] = 1289383; times[2908] = 1298627; times[2909] = 1310259; times[2910] = 1321096; times[2911] = 1332827; times[2912] = 1342197; times[2913] = 1350899; times[2914] = 1356003; times[2915] = 1359199; times[2916] = 1358457; times[2917] = 1355252; times[2918] = 1348860; times[2919] = 1340278; times[2920] = 1330089; times[2921] = 1318678; times[2922] = 1307527; times[2923] = 1296457; times[2924] = 1287297; times[2925] = 1279401; times[2926] = 1274534; times[2927] = 1271685;
    times[2928] = 1272302; times[2929] = 1275100; times[2930] = 1281134; times[2931] = 1288844; times[2932] = 1298981; times[2933] = 1309608; times[2934] = 1321444; times[2935] = 1332099; times[2936] = 1342599; times[2937] = 1350192; times[2938] = 1356483; times[2939] = 1358649; times[2940] = 1358940; times[2941] = 1354928; times[2942] = 1349222; times[2943] = 1340168; times[2944] = 1330284; times[2945] = 1318725; times[2946] = 1307595; times[2947] = 1296587; times[2948] = 1287300; times[2949] = 1279546; times[2950] = 1274517; times[2951] = 1271798;
    times[2952] = 1272281; times[2953] = 1275181; times[2954] = 1281104; times[2955] = 1288917; times[2956] = 1298892; times[2957] = 1309718; times[2958] = 1321234; times[2959] = 1332308; times[2960] = 1342225; times[2961] = 1350551; times[2962] = 1355967; times[2963] = 1359172; times[2964] = 1358386; times[2965] = 1355546; times[2966] = 1348705; times[2967] = 1340725; times[2968] = 1329795; times[2969] = 1319137; times[2970] = 1307116; times[2971] = 1296884; times[2972] = 1286826; times[2973] = 1279815; times[2974] = 1274065; times[2975] = 1272120;
    times[2976] = 1271879; times[2977] = 1275585; times[2978] = 1280765; times[2979] = 1289373; times[2980] = 1298621; times[2981] = 1310151; times[2982] = 1321050; times[2983] = 1332618; times[2984] = 1342166; times[2985] = 1350623; times[2986] = 1356066; times[2987] = 1358943; times[2988] = 1358662; times[2989] = 1355090; times[2990] = 1349147; times[2991] = 1340178; times[2992] = 1330341; times[2993] = 1318576; times[2994] = 1307689; times[2995] = 1296317; times[2996] = 1287387; times[2997] = 1279231; times[2998] = 1274613; times[2999] = 1271531;
    times[3000] = 1272441; times[3001] = 1275021; times[3002] = 1281365; times[3003] = 1288844; times[3004] = 1299252; times[3005] = 1309627; times[3006] = 1321644; times[3007] = 1332072; times[3008] = 1342646; times[3009] = 1350113; times[3010] = 1356344; times[3011] = 1358563; times[3012] = 1358668; times[3013] = 1354928; times[3014] = 1348936; times[3015] = 1340286; times[3016] = 1330043; times[3017] = 1318913; times[3018] = 1307382; times[3019] = 1296789; times[3020] = 1287090; times[3021] = 1279742; times[3022] = 1274308; times[3023] = 1272005;
    times[3024] = 1272106; times[3025] = 1275432; times[3026] = 1280988; times[3027] = 1289224; times[3028] = 1298819; times[3029] = 1310041; times[3030] = 1321148; times[3031] = 1332576; times[3032] = 1342081; times[3033] = 1350696; times[3034] = 1355768; times[3035] = 1359148; times[3036] = 1358168; times[3037] = 1355378; times[3038] = 1348565; times[3039] = 1340548; times[3040] = 1329837; times[3041] = 1319043; times[3042] = 1307320; times[3043] = 1296847; times[3044] = 1287077; times[3045] = 1279751; times[3046] = 1274261; times[3047] = 1271984;
    times[3048] = 1271993; times[3049] = 1275388; times[3050] = 1280830; times[3051] = 1289164; times[3052] = 1298710; times[3053] = 1309968; times[3054] = 1321208; times[3055] = 1332453; times[3056] = 1342382; times[3057] = 1350454; times[3058] = 1356301; times[3059] = 1358774; times[3060] = 1358856; times[3061] = 1354927; times[3062] = 1349252; times[3063] = 1340049; times[3064] = 1330395; times[3065] = 1318523; times[3066] = 1307747; times[3067] = 1296342; times[3068] = 1287459; times[3069] = 1279287; times[3070] = 1274669; times[3071] = 1271549;
    times[3072] = 1272438; times[3073] = 1274956; times[3074] = 1281289; times[3075] = 1288725; times[3076] = 1299142; times[3077] = 1309556; times[3078] = 1321585; times[3079] = 1332161; times[3080] = 1342657; times[3081] = 1350371; times[3082] = 1356360; times[3083] = 1358898; times[3084] = 1358621; times[3085] = 1355232; times[3086] = 1348785; times[3087] = 1340474; times[3088] = 1329790; times[3089] = 1318991; times[3090] = 1307093; times[3091] = 1296831; times[3092] = 1286828; times[3093] = 1279817; times[3094] = 1274100; times[3095] = 1272135;
    times[3096] = 1271938; times[3097] = 1275593; times[3098] = 1280829; times[3099] = 1289381; times[3100] = 1298662; times[3101] = 1310185; times[3102] = 1321038; times[3103] = 1332724; times[3104] = 1342086; times[3105] = 1350846; times[3106] = 1355899; times[3107] = 1359246; times[3108] = 1358382; times[3109] = 1355379; times[3110] = 1348792; times[3111] = 1340418; times[3112] = 1329997; times[3113] = 1318776; times[3114] = 1307400; times[3115] = 1296518; times[3116] = 1287158; times[3117] = 1279464; times[3118] = 1274420; times[3119] = 1271786;
    times[3120] = 1272230; times[3121] = 1275243; times[3122] = 1281090; times[3123] = 1289001; times[3124] = 1298928; times[3125] = 1309734; times[3126] = 1321356; times[3127] = 1332161; times[3128] = 1342488; times[3129] = 1350204; times[3130] = 1356408; times[3131] = 1358651; times[3132] = 1358964; times[3133] = 1354947; times[3134] = 1349344; times[3135] = 1340186; times[3136] = 1330444; times[3137] = 1318702; times[3138] = 1307718; times[3139] = 1296490; times[3140] = 1287352; times[3141] = 1279381; times[3142] = 1274520; times[3143] = 1271611;
    times[3144] = 1272289; times[3145] = 1275022; times[3146] = 1281155; times[3147] = 1288808; times[3148] = 1298996; times[3149] = 1309645; times[3150] = 1321370; times[3151] = 1332238; times[3152] = 1342362; times[3153] = 1350468; times[3154] = 1356086; times[3155] = 1359103; times[3156] = 1358497; times[3157] = 1355548; times[3158] = 1348823; times[3159] = 1340811; times[3160] = 1329909; times[3161] = 1319259; times[3162] = 1307188; times[3163] = 1296974; times[3164] = 1286816; times[3165] = 1279816; times[3166] = 1273960; times[3167] = 1272033;
    times[3168] = 1271713; times[3169] = 1275459; times[3170] = 1280597; times[3171] = 1289279; times[3172] = 1298501; times[3173] = 1310141; times[3174] = 1320993; times[3175] = 1332702; times[3176] = 1342148; times[3177] = 1350779; times[3178] = 1356047; times[3179] = 1359128; times[3180] = 1358631; times[3181] = 1355278; times[3182] = 1349137; times[3183] = 1340374; times[3184] = 1330380; times[3185] = 1318771; times[3186] = 1307749; times[3187] = 1296482; times[3188] = 1287415; times[3189] = 1279328; times[3190] = 1274557; times[3191] = 1271530;
    times[3192] = 1272281; times[3193] = 1274928; times[3194] = 1281134; times[3195] = 1288712; times[3196] = 1299023; times[3197] = 1309524; times[3198] = 1321499; times[3199] = 1332038; times[3200] = 1342632; times[3201] = 1350148; times[3202] = 1356462; times[3203] = 1358629; times[3204] = 1358872; times[3205] = 1354976; times[3206] = 1349165; times[3207] = 1340311; times[3208] = 1330279; times[3209] = 1318936; times[3210] = 1307620; times[3211] = 1296808; times[3212] = 1287306; times[3213] = 1279725; times[3214] = 1274465; times[3215] = 1271910;
    times[3216] = 1272167; times[3217] = 1275232; times[3218] = 1280942; times[3219] = 1288931; times[3220] = 1298707; times[3221] = 1309724; times[3222] = 1321049; times[3223] = 1332326; times[3224] = 1342064; times[3225] = 1350588; times[3226] = 1355850; times[3227] = 1359207; times[3228] = 1358322; times[3229] = 1355566; times[3230] = 1348719; times[3231] = 1340773; times[3232] = 1329935; times[3233] = 1319252; times[3234] = 1307361; times[3235] = 1297032; times[3236] = 1287079; times[3237] = 1279911; times[3238] = 1274231; times[3239] = 1272103;
    times[3240] = 1271913; times[3241] = 1275438; times[3242] = 1280675; times[3243] = 1289129; times[3244] = 1298464; times[3245] = 1309869; times[3246] = 1320907; times[3247] = 1332357; times[3248] = 1342111; times[3249] = 1350443; times[3250] = 1356139; times[3251] = 1358881; times[3252] = 1358852; times[3253] = 1355138; times[3254] = 1349390; times[3255] = 1340299; times[3256] = 1330588; times[3257] = 1318724; times[3258] = 1307909; times[3259] = 1296461; times[3260] = 1287561; times[3261] = 1279339; times[3262] = 1274721; times[3263] = 1271558;
    times[3264] = 1272452; times[3265] = 1274934; times[3266] = 1281261; times[3267] = 1288652; times[3268] = 1299061; times[3269] = 1309405; times[3270] = 1321454; times[3271] = 1331933; times[3272] = 1342530; times[3273] = 1350127; times[3274] = 1356314; times[3275] = 1358718; times[3276] = 1358708; times[3277] = 1355176; times[3278] = 1349008; times[3279] = 1340555; times[3280] = 1330099; times[3281] = 1319140; times[3282] = 1307391; times[3283] = 1296950; times[3284] = 1287038; times[3285] = 1279844; times[3286] = 1274211; times[3287] = 1272071;
    times[3288] = 1271980; times[3289] = 1275473; times[3290] = 1280838; times[3291] = 1289236; times[3292] = 1298645; times[3293] = 1310026; times[3294] = 1320977; times[3295] = 1332549; times[3296] = 1341959; times[3297] = 1350683; times[3298] = 1355735; times[3299] = 1359163; times[3300] = 1358247; times[3301] = 1355426; times[3302] = 1348740; times[3303] = 1340612; times[3304] = 1330051; times[3305] = 1319085; times[3306] = 1307522; times[3307] = 1296852; times[3308] = 1287260; times[3309] = 1279733; times[3310] = 1274428; times[3311] = 1271942;
    times[3312] = 1272124; times[3313] = 1275295; times[3314] = 1280901; times[3315] = 1289002; times[3316] = 1298709; times[3317] = 1309729; times[3318] = 1321145; times[3319] = 1332159; times[3320] = 1342291; times[3321] = 1350175; times[3322] = 1356226; times[3323] = 1358587; times[3324] = 1358843; times[3325] = 1354885; times[3326] = 1349329; times[3327] = 1340169; times[3328] = 1330558; times[3329] = 1318759; times[3330] = 1307946; times[3331] = 1296611; times[3332] = 1287628; times[3333] = 1279504; times[3334] = 1274756; times[3335] = 1271660;
    times[3336] = 1272420; times[3337] = 1274955; times[3338] = 1281170; times[3339] = 1288638; times[3340] = 1298939; times[3341] = 1309425; times[3342] = 1321320; times[3343] = 1332022; times[3344] = 1342364; times[3345] = 1350276; times[3346] = 1356117; times[3347] = 1358923; times[3348] = 1358520; times[3349] = 1355396; times[3350] = 1348835; times[3351] = 1340722; times[3352] = 1329934; times[3353] = 1319260; times[3354] = 1307267; times[3355] = 1297070; times[3356] = 1286958; times[3357] = 1279973; times[3358] = 1274131; times[3359] = 1272181;
    times[3360] = 1271846; times[3361] = 1275531; times[3362] = 1280635; times[3363] = 1289245; times[3364] = 1298428; times[3365] = 1310029; times[3366] = 1320843; times[3367] = 1332587; times[3368] = 1341982; times[3369] = 1350738; times[3370] = 1355902; times[3371] = 1359170; times[3372] = 1358495; times[3373] = 1355354; times[3374] = 1348996; times[3375] = 1340447; times[3376] = 1330249; times[3377] = 1318837; times[3378] = 1307653; times[3379] = 1296573; times[3380] = 1287373; times[3381] = 1279472; times[3382] = 1274568; times[3383] = 1271716;
    times[3384] = 1272311; times[3385] = 1275110; times[3386] = 1281128; times[3387] = 1288834; times[3388] = 1298939; times[3389] = 1309547; times[3390] = 1321340; times[3391] = 1331974; times[3392] = 1342460; times[3393] = 1350055; times[3394] = 1356365; times[3395] = 1358558; times[3396] = 1358892; times[3397] = 1354920; times[3398] = 1349255; times[3399] = 1340237; times[3400] = 1330380; times[3401] = 1318825; times[3402] = 1307699; times[3403] = 1296669; times[3404] = 1287372; times[3405] = 1279589; times[3406] = 1274552; times[3407] = 1271809;
    times[3408] = 1272294; times[3409] = 1275168; times[3410] = 1281098; times[3411] = 1288879; times[3412] = 1298851; times[3413] = 1309641; times[3414] = 1321147; times[3415] = 1332184; times[3416] = 1342105; times[3417] = 1350417; times[3418] = 1355857; times[3419] = 1359086; times[3420] = 1358343; times[3421] = 1355549; times[3422] = 1348758; times[3423] = 1340842; times[3424] = 1329964; times[3425] = 1319342; times[3426] = 1307338; times[3427] = 1297086; times[3428] = 1286984; times[3429] = 1279911; times[3430] = 1274090; times[3431] = 1272077;
    times[3432] = 1271775; times[3433] = 1275430; times[3434] = 1280575; times[3435] = 1289165; times[3436] = 1298402; times[3437] = 1309948; times[3438] = 1320851; times[3439] = 1332458; times[3440] = 1342024; times[3441] = 1350540; times[3442] = 1356014; times[3443] = 1358967; times[3444] = 1358737; times[3445] = 1355238; times[3446] = 1349342; times[3447] = 1340423; times[3448] = 1330607; times[3449] = 1318846; times[3450] = 1307947; times[3451] = 1296539; times[3452] = 1287555; times[3453] = 1279337; times[3454] = 1274633; times[3455] = 1271476;
    times[3456] = 1272295; times[3457] = 1274812; times[3458] = 1281091; times[3459] = 1288547; times[3460] = 1298938; times[3461] = 1309352; times[3462] = 1321418; times[3463] = 1331925; times[3464] = 1342584; times[3465] = 1350127; times[3466] = 1356428; times[3467] = 1358687; times[3468] = 1358845; times[3469] = 1355116; times[3470] = 1349164; times[3471] = 1340511; times[3472] = 1330280; times[3473] = 1319127; times[3474] = 1307579; times[3475] = 1296942; times[3476] = 1287198; times[3477] = 1279795; times[3478] = 1274303; times[3479] = 1271936;
    times[3480] = 1271981; times[3481] = 1275245; times[3482] = 1280765; times[3483] = 1288960; times[3484] = 1298556; times[3485] = 1309779; times[3486] = 1320935; times[3487] = 1332398; times[3488] = 1341989; times[3489] = 1350661; times[3490] = 1355813; times[3491] = 1359250; times[3492] = 1358324; times[3493] = 1355571; times[3494] = 1348771; times[3495] = 1340777; times[3496] = 1330049; times[3497] = 1319263; times[3498] = 1307512; times[3499] = 1297039; times[3500] = 1287240; times[3501] = 1279904; times[3502] = 1274372; times[3503] = 1272053;
    times[3504] = 1271993; times[3505] = 1275313; times[3506] = 1280672; times[3507] = 1288930; times[3508] = 1298406; times[3509] = 1309625; times[3510] = 1320838; times[3511] = 1332105; times[3512] = 1342069; times[3513] = 1350224; times[3514] = 1356144; times[3515] = 1358738; times[3516] = 1358904; times[3517] = 1355079; times[3518] = 1349471; times[3519] = 1340328; times[3520] = 1330704; times[3521] = 1318843; times[3522] = 1308067; times[3523] = 1296637; times[3524] = 1287726; times[3525] = 1279501; times[3526] = 1274832; times[3527] = 1271633;
    times[3528] = 1272455; times[3529] = 1274884; times[3530] = 1281143; times[3531] = 1288493; times[3532] = 1298843; times[3533] = 1309201; times[3534] = 1321191; times[3535] = 1331759; times[3536] = 1342284; times[3537] = 1350057; times[3538] = 1356157; times[3539] = 1358819; times[3540] = 1358700; times[3541] = 1355424; times[3542] = 1349100; times[3543] = 1340838; times[3544] = 1330195; times[3545] = 1319376; times[3546] = 1307453; times[3547] = 1297126; times[3548] = 1287056; times[3549] = 1279965; times[3550] = 1274172; times[3551] = 1272129;
    times[3552] = 1271863; times[3553] = 1275451; times[3554] = 1280633; times[3555] = 1289138; times[3556] = 1298382; times[3557] = 1309887; times[3558] = 1320729; times[3559] = 1332423; times[3560] = 1341814; times[3561] = 1350614; times[3562] = 1355738; times[3563] = 1359172; times[3564] = 1358409; times[3565] = 1355515; times[3566] = 1349018; times[3567] = 1340736; times[3568] = 1330353; times[3569] = 1319166; times[3570] = 1307759; times[3571] = 1296847; times[3572] = 1287399; times[3573] = 1279639; times[3574] = 1274487; times[3575] = 1271787;
    times[3576] = 1272150; times[3577] = 1275129; times[3578] = 1280936; times[3579] = 1288838; times[3580] = 1298742; times[3581] = 1309545; times[3582] = 1321146; times[3583] = 1331949; times[3584] = 1342271; times[3585] = 1349995; times[3586] = 1356214; times[3587] = 1358491; times[3588] = 1358849; times[3589] = 1354897; times[3590] = 1349366; times[3591] = 1340291; times[3592] = 1330626; times[3593] = 1318943; times[3594] = 1308011; times[3595] = 1296792; times[3596] = 1287653; times[3597] = 1279641; times[3598] = 1274731; times[3599] = 1271743;
    times[3600] = 1272355; times[3601] = 1274999; times[3602] = 1281078; times[3603] = 1288658; times[3604] = 1298813; times[3605] = 1309418; times[3606] = 1321138; times[3607] = 1331987; times[3608] = 1342131; times[3609] = 1350240; times[3610] = 1355891; times[3611] = 1358932; times[3612] = 1358371; times[3613] = 1355466; times[3614] = 1348811; times[3615] = 1340879; times[3616] = 1330072; times[3617] = 1319498; times[3618] = 1307500; times[3619] = 1297311; times[3620] = 1287158; times[3621] = 1280128; times[3622] = 1274215; times[3623] = 1272209;
    times[3624] = 1271796; times[3625] = 1275440; times[3626] = 1280481; times[3627] = 1289076; times[3628] = 1298228; times[3629] = 1309829; times[3630] = 1320659; times[3631] = 1332387; times[3632] = 1341859; times[3633] = 1350557; times[3634] = 1355877; times[3635] = 1359048; times[3636] = 1358611; times[3637] = 1355332; times[3638] = 1349239; times[3639] = 1340530; times[3640] = 1330564; times[3641] = 1318984; times[3642] = 1307979; times[3643] = 1296722; times[3644] = 1287643; times[3645] = 1279547; times[3646] = 1274729; times[3647] = 1271665;
    times[3648] = 1272340; times[3649] = 1274925; times[3650] = 1281040; times[3651] = 1288556; times[3652] = 1298793; times[3653] = 1309273; times[3654] = 1321237; times[3655] = 1331811; times[3656] = 1342452; times[3657] = 1350028; times[3658] = 1356406; times[3659] = 1358626; times[3660] = 1358932; times[3661] = 1355064; times[3662] = 1349294; times[3663] = 1340440; times[3664] = 1330412; times[3665] = 1319048; times[3666] = 1307721; times[3667] = 1296882; times[3668] = 1287367; times[3669] = 1279770; times[3670] = 1274503; times[3671] = 1271935;
    times[3672] = 1272187; times[3673] = 1275228; times[3674] = 1280932; times[3675] = 1288883; times[3676] = 1298646; times[3677] = 1309626; times[3678] = 1320947; times[3679] = 1332198; times[3680] = 1341959; times[3681] = 1350485; times[3682] = 1355790; times[3683] = 1359180; times[3684] = 1358344; times[3685] = 1355628; times[3686] = 1348815; times[3687] = 1340902; times[3688] = 1330062; times[3689] = 1319385; times[3690] = 1307471; times[3691] = 1297133; times[3692] = 1287159; times[3693] = 1279985; times[3694] = 1274285; times[3695] = 1272140;
    times[3696] = 1271923; times[3697] = 1275415; times[3698] = 1280618; times[3699] = 1289038; times[3700] = 1298337; times[3701] = 1309716; times[3702] = 1320721; times[3703] = 1332166; times[3704] = 1341908; times[3705] = 1350270; times[3706] = 1355982; times[3707] = 1358796; times[3708] = 1358811; times[3709] = 1355180; times[3710] = 1349489; times[3711] = 1340467; times[3712] = 1330796; times[3713] = 1318962; times[3714] = 1308158; times[3715] = 1296687; times[3716] = 1287755; times[3717] = 1279472; times[3718] = 1274793; times[3719] = 1271557;
    times[3720] = 1272387; times[3721] = 1274807; times[3722] = 1281091; times[3723] = 1288447; times[3724] = 1298832; times[3725] = 1309175; times[3726] = 1321220; times[3727] = 1331718; times[3728] = 1342342; times[3729] = 1349981; times[3730] = 1356240; times[3731] = 1358719; times[3732] = 1358810; times[3733] = 1355339; times[3734] = 1349252; times[3735] = 1340819; times[3736] = 1330393; times[3737] = 1319416; times[3738] = 1307657; times[3739] = 1297166; times[3740] = 1287205; times[3741] = 1279938; times[3742] = 1274229; times[3743] = 1272003;
    times[3744] = 1271836; times[3745] = 1275253; times[3746] = 1280568; times[3747] = 1288931; times[3748] = 1298336; times[3749] = 1309735; times[3750] = 1320727; times[3751] = 1332352; times[3752] = 1341839; times[3753] = 1350623; times[3754] = 1355755; times[3755] = 1359245; times[3756] = 1358395; times[3757] = 1355629; times[3758] = 1348980; times[3759] = 1340894; times[3760] = 1330333; times[3761] = 1319375; times[3762] = 1307776; times[3763] = 1297078; times[3764] = 1287415; times[3765] = 1279840; times[3766] = 1274444; times[3767] = 1271904;
    times[3768] = 1272008; times[3769] = 1275139; times[3770] = 1280695; times[3771] = 1288775; times[3772] = 1298457; times[3773] = 1309479; times[3774] = 1320896; times[3775] = 1331946; times[3776] = 1342117; times[3777] = 1350063; times[3778] = 1356168; times[3779] = 1358600; times[3780] = 1358897; times[3781] = 1354993; times[3782] = 1349466; times[3783] = 1340343; times[3784] = 1330753; times[3785] = 1318971; times[3786] = 1308172; times[3787] = 1296827; times[3788] = 1287834; times[3789] = 1279677; times[3790] = 1274894; times[3791] = 1271740;
    times[3792] = 1272449; times[3793] = 1274908; times[3794] = 1281068; times[3795] = 1288455; times[3796] = 1298709; times[3797] = 1309137; times[3798] = 1321014; times[3799] = 1331707; times[3800] = 1342084; times[3801] = 1350040; times[3802] = 1355961; times[3803] = 1358847; times[3804] = 1358537; times[3805] = 1355486; times[3806] = 1349010; times[3807] = 1340956; times[3808] = 1330225; times[3809] = 1319568; times[3810] = 1307591; times[3811] = 1297363; times[3812] = 1287220; times[3813] = 1280178; times[3814] = 1274273; times[3815] = 1272252;
    times[3816] = 1271842; times[3817] = 1275444; times[3818] = 1280477; times[3819] = 1289010; times[3820] = 1298134; times[3821] = 1309688; times[3822] = 1320471; times[3823] = 1332221; times[3824] = 1341637; times[3825] = 1350461; times[3826] = 1355702; times[3827] = 1359091; times[3828] = 1358525; times[3829] = 1355509; times[3830] = 1349248; times[3831] = 1340783; times[3832] = 1330619; times[3833] = 1319224; times[3834] = 1308011; times[3835] = 1296892; times[3836] = 1287618; times[3837] = 1279658; times[3838] = 1274663; times[3839] = 1271752;
    times[3840] = 1272257; times[3841] = 1275002; times[3842] = 1280945; times[3843] = 1288610; times[3844] = 1298667; times[3845] = 1309272; times[3846] = 1321058; times[3847] = 1331727; times[3848] = 1342241; times[3849] = 1349884; times[3850] = 1356245; times[3851] = 1358497; times[3852] = 1358910; times[3853] = 1355003; times[3854] = 1349425; times[3855] = 1340463; times[3856] = 1330655; times[3857] = 1319119; times[3858] = 1307994; times[3859] = 1296927; times[3860] = 1287586; times[3861] = 1279736; times[3862] = 1274633; times[3863] = 1271819;
    times[3864] = 1272252; times[3865] = 1275065; times[3866] = 1280968; times[3867] = 1288708; times[3868] = 1298678; times[3869] = 1309446; times[3870] = 1320969; times[3871] = 1331997; times[3872] = 1341948; times[3873] = 1350261; times[3874] = 1355737; times[3875] = 1358990; times[3876] = 1358296; times[3877] = 1355549; times[3878] = 1348818; times[3879] = 1340965; times[3880] = 1330131; times[3881] = 1319563; times[3882] = 1307587; times[3883] = 1297358; times[3884] = 1287260; times[3885] = 1280171; times[3886] = 1274309; times[3887] = 1272231;
    times[3888] = 1271848; times[3889] = 1275411; times[3890] = 1280474; times[3891] = 1288988; times[3892] = 1298166; times[3893] = 1309676; times[3894] = 1320553; times[3895] = 1332167; times[3896] = 1341742; times[3897] = 1350298; times[3898] = 1355799; times[3899] = 1358821; times[3900] = 1358626; times[3901] = 1355204; times[3902] = 1349363; times[3903] = 1340526; times[3904] = 1330771; times[3905] = 1319078; times[3906] = 1308229; times[3907] = 1296849; times[3908] = 1287876; times[3909] = 1279640; times[3910] = 1274893; times[3911] = 1271672;
    times[3912] = 1272406; times[3913] = 1274831; times[3914] = 1281011; times[3915] = 1288382; times[3916] = 1298691; times[3917] = 1309061; times[3918] = 1321085; times[3919] = 1331599; times[3920] = 1342280; times[3921] = 1349876; times[3922] = 1356261; times[3923] = 1358612; times[3924] = 1358873; times[3925] = 1355205; times[3926] = 1349324; times[3927] = 1340683; times[3928] = 1330482; times[3929] = 1319320; times[3930] = 1307785; times[3931] = 1297126; times[3932] = 1287377; times[3933] = 1279942; times[3934] = 1274422; times[3935] = 1272009;
    times[3936] = 1272007; times[3937] = 1275207; times[3938] = 1280671; times[3939] = 1288802; times[3940] = 1298357; times[3941] = 1309542; times[3942] = 1320691; times[3943] = 1332159; times[3944] = 1341794; times[3945] = 1350502; times[3946] = 1355733; times[3947] = 1359237; times[3948] = 1358386; times[3949] = 1355696; times[3950] = 1348942; times[3951] = 1340980; times[3952] = 1330244; times[3953] = 1319453; times[3954] = 1307659; times[3955] = 1297161; times[3956] = 1287308; times[3957] = 1279950; times[3958] = 1274371; times[3959] = 1272044;
    times[3960] = 1271961; times[3961] = 1275286; times[3962] = 1280638; times[3963] = 1288891; times[3964] = 1298346; times[3965] = 1309542; times[3966] = 1320719; times[3967] = 1331970; times[3968] = 1341919; times[3969] = 1350087; times[3970] = 1356020; times[3971] = 1358660; times[3972] = 1358855; times[3973] = 1355092; times[3974] = 1349525; times[3975] = 1340435; times[3976] = 1330840; times[3977] = 1318998; times[3978] = 1308226; times[3979] = 1296774; times[3980] = 1287840; times[3981] = 1279577; times[3982] = 1274875; times[3983] = 1271640;
    times[3984] = 1272439; times[3985] = 1274834; times[3986] = 1281083; times[3987] = 1288403; times[3988] = 1298744; times[3989] = 1309074; times[3990] = 1321053; times[3991] = 1331603; times[3992] = 1342128; times[3993] = 1349904; times[3994] = 1356033; times[3995] = 1358728; times[3996] = 1358665; times[3997] = 1355438; times[3998] = 1349194; times[3999] = 1340989; times[4000] = 1330423; times[4001] = 1319629; times[4002] = 1307733; times[4003] = 1297370; times[4004] = 1287262; times[4005] = 1280092; times[4006] = 1274224; times[4007] = 1272091;
    times[4008] = 1271751; times[4009] = 1275265; times[4010] = 1280402; times[4011] = 1288870; times[4012] = 1298107; times[4013] = 1309618; times[4014] = 1320481; times[4015] = 1332214; times[4016] = 1341645; times[4017] = 1350503; times[4018] = 1355682; times[4019] = 1359188; times[4020] = 1358489; times[4021] = 1355667; times[4022] = 1349230; times[4023] = 1341003; times[4024] = 1330642; times[4025] = 1319477; times[4026] = 1308051; times[4027] = 1297118; times[4028] = 1287611; times[4029] = 1279800; times[4030] = 1274550; times[4031] = 1271779;
    times[4032] = 1272033; times[4033] = 1274942; times[4034] = 1280664; times[4035] = 1288530; times[4036] = 1298406; times[4037] = 1309242; times[4038] = 1320881; times[4039] = 1331771; times[4040] = 1342166; times[4041] = 1349972; times[4042] = 1356254; times[4043] = 1358585; times[4044] = 1358989; times[4045] = 1355067; times[4046] = 1349569; times[4047] = 1340513; times[4048] = 1330857; times[4049] = 1319177; times[4050] = 1308234; times[4051] = 1296986; times[4052] = 1287816; times[4053] = 1279750; times[4054] = 1274791; times[4055] = 1271737;
    times[4056] = 1272290; times[4057] = 1274861; times[4058] = 1280892; times[4059] = 1288412; times[4060] = 1298551; times[4061] = 1309135; times[4062] = 1320885; times[4063] = 1331758; times[4064] = 1341979; times[4065] = 1350139; times[4066] = 1355878; times[4067] = 1358980; times[4068] = 1358484; times[4069] = 1355618; times[4070] = 1348997; times[4071] = 1341081; times[4072] = 1330276; times[4073] = 1319706; times[4074] = 1307710; times[4075] = 1297518; times[4076] = 1287370; times[4077] = 1280322; times[4078] = 1274384; times[4079] = 1272327;
    times[4080] = 1271849; times[4081] = 1275408; times[4082] = 1280366; times[4083] = 1288871; times[4084] = 1297950; times[4085] = 1309492; times[4086] = 1320283; times[4087] = 1332017; times[4088] = 1341510; times[4089] = 1350283; times[4090] = 1355676; times[4091] = 1358968; times[4092] = 1358618; times[4093] = 1355454; times[4094] = 1349434; times[4095] = 1340798; times[4096] = 1330863; times[4097] = 1319310; times[4098] = 1308302; times[4099] = 1297030; times[4100] = 1287923; times[4101] = 1279789; times[4102] = 1274915; times[4103] = 1271795;
    times[4104] = 1272390; times[4105] = 1274905; times[4106] = 1280931; times[4107] = 1288375; times[4108] = 1298525; times[4109] = 1308955; times[4110] = 1320857; times[4111] = 1331420; times[4112] = 1342066; times[4113] = 1349698; times[4114] = 1356173; times[4115] = 1358517; times[4116] = 1358968; times[4117] = 1355214; times[4118] = 1349564; times[4119] = 1340764; times[4120] = 1330788; times[4121] = 1319413; times[4122] = 1308072; times[4123] = 1297172; times[4124] = 1287600; times[4125] = 1279925; times[4126] = 1274585; times[4127] = 1271945;
    times[4128] = 1272133; times[4129] = 1275110; times[4130] = 1280768; times[4131] = 1288669; times[4132] = 1298408; times[4133] = 1309357; times[4134] = 1320679; times[4135] = 1331922; times[4136] = 1341717; times[4137] = 1350257; times[4138] = 1355631; times[4139] = 1359083; times[4140] = 1358338; times[4141] = 1355712; times[4142] = 1348989; times[4143] = 1341158; times[4144] = 1330363; times[4145] = 1319726; times[4146] = 1307795; times[4147] = 1297439; times[4148] = 1287396; times[4149] = 1280161; times[4150] = 1274374; times[4151] = 1272169;
    times[4152] = 1271888; times[4153] = 1275346; times[4154] = 1280521; times[4155] = 1288917; times[4156] = 1298198; times[4157] = 1309556; times[4158] = 1320537; times[4159] = 1331974; times[4160] = 1341701; times[4161] = 1350071; times[4162] = 1355781; times[4163] = 1358631; times[4164] = 1358662; times[4165] = 1355100; times[4166] = 1349461; times[4167] = 1340524; times[4168] = 1330919; times[4169] = 1319160; times[4170] = 1308405; times[4171] = 1296964; times[4172] = 1288041; times[4173] = 1279737; times[4174] = 1275018; times[4175] = 1271722;
    times[4176] = 1272485; times[4177] = 1274827; times[4178] = 1281047; times[4179] = 1288334; times[4180] = 1298675; times[4181] = 1308976; times[4182] = 1320995; times[4183] = 1331486; times[4184] = 1342110; times[4185] = 1349761; times[4186] = 1356047; times[4187] = 1358552; times[4188] = 1358685; times[4189] = 1355250; times[4190] = 1349240; times[4191] = 1340862; times[4192] = 1330531; times[4193] = 1319607; times[4194] = 1307915; times[4195] = 1297434; times[4196] = 1287491; times[4197] = 1280191; times[4198] = 1274450; times[4199] = 1272157;
    times[4200] = 1271919; times[4201] = 1275245; times[4202] = 1280484; times[4203] = 1288762; times[4204] = 1298112; times[4205] = 1309467; times[4206] = 1320443; times[4207] = 1332078; times[4208] = 1341594; times[4209] = 1350426; times[4210] = 1355625; times[4211] = 1359182; times[4212] = 1358400; times[4213] = 1355694; times[4214] = 1349091; times[4215] = 1341043; times[4216] = 1330493; times[4217] = 1319557; times[4218] = 1307950; times[4219] = 1297260; times[4220] = 1287574; times[4221] = 1279997; times[4222] = 1274557; times[4223] = 1271999;
    times[4224] = 1272037; times[4225] = 1275132; times[4226] = 1280613; times[4227] = 1288649; times[4228] = 1298277; times[4229] = 1309289; times[4230] = 1320698; times[4231] = 1331784; times[4232] = 1341987; times[4233] = 1349984; times[4234] = 1356134; times[4235] = 1358617; times[4236] = 1358956; times[4237] = 1355093; times[4238] = 1349589; times[4239] = 1340479; times[4240] = 1330874; times[4241] = 1319078; times[4242] = 1308247; times[4243] = 1296869; times[4244] = 1287854; times[4245] = 1279667; times[4246] = 1274873; times[4247] = 1271706;
    times[4248] = 1272414; times[4249] = 1274864; times[4250] = 1281026; times[4251] = 1288397; times[4252] = 1298655; times[4253] = 1309059; times[4254] = 1320941; times[4255] = 1331619; times[4256] = 1342017; times[4257] = 1349973; times[4258] = 1355934; times[4259] = 1358844; times[4260] = 1358579; times[4261] = 1355559; times[4262] = 1349118; times[4263] = 1341082; times[4264] = 1330361; times[4265] = 1319697; times[4266] = 1307712; times[4267] = 1297457; times[4268] = 1287304; times[4269] = 1280227; times[4270] = 1274301; times[4271] = 1272238;
    times[4272] = 1271797; times[4273] = 1275358; times[4274] = 1280365; times[4275] = 1288868; times[4276] = 1297977; times[4277] = 1309514; times[4278] = 1320289; times[4279] = 1332043; times[4280] = 1341466; times[4281] = 1350322; times[4282] = 1355592; times[4283] = 1359050; times[4284] = 1358529; times[4285] = 1355593; times[4286] = 1349385; times[4287] = 1340984; times[4288] = 1330853; times[4289] = 1319489; times[4290] = 1308271; times[4291] = 1297132; times[4292] = 1287810; times[4293] = 1279792; times[4294] = 1274713; times[4295] = 1271731;
    times[4296] = 1272146; times[4297] = 1274837; times[4298] = 1280712; times[4299] = 1288355; times[4300] = 1298382; times[4301] = 1309003; times[4302] = 1320790; times[4303] = 1331505; times[4304] = 1342053; times[4305] = 1349764; times[4306] = 1356203; times[4307] = 1358544; times[4308] = 1359049; times[4309] = 1355209; times[4310] = 1349700; times[4311] = 1340757; times[4312] = 1330972; times[4313] = 1319416; times[4314] = 1308272; times[4315] = 1297149; times[4316] = 1287753; times[4317] = 1279822; times[4318] = 1274639; times[4319] = 1271735;
    times[4320] = 1272083; times[4321] = 1274819; times[4322] = 1280667; times[4323] = 1288365; times[4324] = 1298339; times[4325] = 1309115; times[4326] = 1320698; times[4327] = 1331779; times[4328] = 1341826; times[4329] = 1350201; times[4330] = 1355779; times[4331] = 1359092; times[4332] = 1358473; times[4333] = 1355776; times[4334] = 1349092; times[4335] = 1341267; times[4336] = 1330440; times[4337] = 1319874; times[4338] = 1307862; times[4339] = 1297597; times[4340] = 1287433; times[4341] = 1280280; times[4342] = 1274337; times[4343] = 1272193;
    times[4344] = 1271742; times[4345] = 1275252; times[4346] = 1280269; times[4347] = 1288739; times[4348] = 1297891; times[4349] = 1309380; times[4350] = 1320258; times[4351] = 1331905; times[4352] = 1341521; times[4353] = 1350152; times[4354] = 1355713; times[4355] = 1358827; times[4356] = 1358679; times[4357] = 1355333; times[4358] = 1349522; times[4359] = 1340733; times[4360] = 1330992; times[4361] = 1319324; times[4362] = 1308479; times[4363] = 1297094; times[4364] = 1288106; times[4365] = 1279835; times[4366] = 1275044; times[4367] = 1271765;
    times[4368] = 1272432; times[4369] = 1274784; times[4370] = 1280890; times[4371] = 1288187; times[4372] = 1298430; times[4373] = 1308749; times[4374] = 1320736; times[4375] = 1331253; times[4376] = 1341950; times[4377] = 1349604; times[4378] = 1356067; times[4379] = 1358508; times[4380] = 1358876; times[4381] = 1355297; times[4382] = 1349528; times[4383] = 1340948; times[4384] = 1330823; times[4385] = 1319673; times[4386] = 1308154; times[4387] = 1297451; times[4388] = 1287672; times[4389] = 1280166; times[4390] = 1274586; times[4391] = 1272090;
    times[4392] = 1272010; times[4393] = 1275123; times[4394] = 1280511; times[4395] = 1288561; times[4396] = 1298057; times[4397] = 1309186; times[4398] = 1320310; times[4399] = 1331769; times[4400] = 1341433; times[4401] = 1350189; times[4402] = 1355515; times[4403] = 1359116; times[4404] = 1358396; times[4405] = 1355825; times[4406] = 1349184; times[4407] = 1341316; times[4408] = 1330628; times[4409] = 1319870; times[4410] = 1308053; times[4411] = 1297521; times[4412] = 1287595; times[4413] = 1280171; times[4414] = 1274494; times[4415] = 1272098;
    times[4416] = 1271916; times[4417] = 1275181; times[4418] = 1280449; times[4419] = 1288658; times[4420] = 1298066; times[4421] = 1309258; times[4422] = 1320433; times[4423] = 1331716; times[4424] = 1341688; times[4425] = 1349899; times[4426] = 1355871; times[4427] = 1358574; times[4428] = 1358826; times[4429] = 1355147; times[4430] = 1349646; times[4431] = 1340634; times[4432] = 1331086; times[4433] = 1319287; times[4434] = 1308522; times[4435] = 1297056; times[4436] = 1288089; times[4437] = 1279769; times[4438] = 1275006; times[4439] = 1271702;
    times[4440] = 1272439; times[4441] = 1274775; times[4442] = 1280981; times[4443] = 1288257; times[4444] = 1298583; times[4445] = 1308886; times[4446] = 1320870; times[4447] = 1331414; times[4448] = 1341955; times[4449] = 1349737; times[4450] = 1355895; times[4451] = 1358610; times[4452] = 1358587; times[4453] = 1355400; times[4454] = 1349219; times[4455] = 1341063; times[4456] = 1330562; times[4457] = 1319817; times[4458] = 1307983; times[4459] = 1297646; times[4460] = 1287577; times[4461] = 1280391; times[4462] = 1274500; times[4463] = 1272295;
    times[4464] = 1271877; times[4465] = 1275289; times[4466] = 1280337; times[4467] = 1288711; times[4468] = 1297886; times[4469] = 1309338; times[4470] = 1320176; times[4471] = 1331902; times[4472] = 1341344; times[4473] = 1350240; times[4474] = 1355457; times[4475] = 1359028; times[4476] = 1358376; times[4477] = 1355626; times[4478] = 1349248; times[4479] = 1341092; times[4480] = 1330788; times[4481] = 1319690; times[4482] = 1308306; times[4483] = 1297412; times[4484] = 1287912; times[4485] = 1280099; times[4486] = 1274807; times[4487] = 1271995;
    times[4488] = 1272160; times[4489] = 1274996; times[4490] = 1280609; times[4491] = 1288399; times[4492] = 1298182; times[4493] = 1308970; times[4494] = 1320558; times[4495] = 1331454; times[4496] = 1341859; times[4497] = 1349728; times[4498] = 1356090; times[4499] = 1358519; times[4500] = 1359017; times[4501] = 1355163; times[4502] = 1349723; times[4503] = 1340680; times[4504] = 1331038; times[4505] = 1319352; times[4506] = 1308403; times[4507] = 1297138; times[4508] = 1287958; times[4509] = 1279870; times[4510] = 1274890; times[4511] = 1271805;
    times[4512] = 1272324; times[4513] = 1274848; times[4514] = 1280835; times[4515] = 1288299; times[4516] = 1298404; times[4517] = 1308942; times[4518] = 1320687; times[4519] = 1331549; times[4520] = 1341808; times[4521] = 1349989; times[4522] = 1355803; times[4523] = 1358954; times[4524] = 1358535; times[4525] = 1355724; times[4526] = 1349156; times[4527] = 1341266; times[4528] = 1330461; times[4529] = 1319881; times[4530] = 1307845; times[4531] = 1297616; times[4532] = 1287423; times[4533] = 1280338; times[4534] = 1274372; times[4535] = 1272299;
    times[4536] = 1271821; times[4537] = 1275384; times[4538] = 1280353; times[4539] = 1288848; times[4540] = 1297920; times[4541] = 1309426; times[4542] = 1320188; times[4543] = 1331897; times[4544] = 1341370; times[4545] = 1350150; times[4546] = 1355550; times[4547] = 1358886; times[4548] = 1358556; times[4549] = 1355458; times[4550] = 1349469; times[4551] = 1340891; times[4552] = 1330980; times[4553] = 1319458; times[4554] = 1308446; times[4555] = 1297163; times[4556] = 1288030; times[4557] = 1279859; times[4558] = 1274950; times[4559] = 1271795;
    times[4560] = 1272359; times[4561] = 1274856; times[4562] = 1280859; times[4563] = 1288295; times[4564] = 1298429; times[4565] = 1308854; times[4566] = 1320731; times[4567] = 1331299; times[4568] = 1341925; times[4569] = 1349569; times[4570] = 1356061; times[4571] = 1358437; times[4572] = 1358937; times[4573] = 1355235; times[4574] = 1349666; times[4575] = 1340917; times[4576] = 1331015; times[4577] = 1319659; times[4578] = 1308339; times[4579] = 1297398; times[4580] = 1287792; times[4581] = 1280037; times[4582] = 1274628; times[4583] = 1271899;
    times[4584] = 1272012; times[4585] = 1274920; times[4586] = 1280531; times[4587] = 1288400; times[4588] = 1298138; times[4589] = 1309091; times[4590] = 1320449; times[4591] = 1331727; times[4592] = 1341580; times[4593] = 1350164; times[4594] = 1355613; times[4595] = 1359111; times[4596] = 1358443; times[4597] = 1355872; times[4598] = 1349213; times[4599] = 1341425; times[4600] = 1330651; times[4601] = 1320028; times[4602] = 1308070; times[4603] = 1297687; times[4604] = 1287581; times[4605] = 1280287; times[4606] = 1274408; times[4607] = 1272129;
    times[4608] = 1271746; times[4609] = 1275136; times[4610] = 1280232; times[4611] = 1288597; times[4612] = 1297863; times[4613] = 1309253; times[4614] = 1320291; times[4615] = 1331812; times[4616] = 1341617; times[4617] = 1350071; times[4618] = 1355840; times[4619] = 1358751; times[4620] = 1358811; times[4621] = 1355294; times[4622] = 1349661; times[4623] = 1340751; times[4624] = 1331141; times[4625] = 1319386; times[4626] = 1308609; times[4627] = 1297144; times[4628] = 1288182; times[4629] = 1279829; times[4630] = 1275057; times[4631] = 1271702;
    times[4632] = 1272404; times[4633] = 1274689; times[4634] = 1280855; times[4635] = 1288094; times[4636] = 1298413; times[4637] = 1308697; times[4638] = 1320741; times[4639] = 1331264; times[4640] = 1341949; times[4641] = 1349668; times[4642] = 1356033; times[4643] = 1358608; times[4644] = 1358809; times[4645] = 1355416; times[4646] = 1349447; times[4647] = 1341073; times[4648] = 1330758; times[4649] = 1319820; times[4650] = 1308142; times[4651] = 1297645; times[4652] = 1287712; times[4653] = 1280379; times[4654] = 1274612; times[4655] = 1272249;
    times[4656] = 1271945; times[4657] = 1275179; times[4658] = 1280338; times[4659] = 1288525; times[4660] = 1297813; times[4661] = 1309102; times[4662] = 1320055; times[4663] = 1331688; times[4664] = 1341237; times[4665] = 1350137; times[4666] = 1355426; times[4667] = 1359097; times[4668] = 1358425; times[4669] = 1355832; times[4670] = 1349321; times[4671] = 1341345; times[4672] = 1330833; times[4673] = 1319922; times[4674] = 1308296; times[4675] = 1297588; times[4676] = 1287854; times[4677] = 1280229; times[4678] = 1274717; times[4679] = 1272099;
    times[4680] = 1272046; times[4681] = 1275076; times[4682] = 1280461; times[4683] = 1288436; times[4684] = 1297981; times[4685] = 1308952; times[4686] = 1320306; times[4687] = 1331395; times[4688] = 1341600; times[4689] = 1349670; times[4690] = 1355911; times[4691] = 1358525; times[4692] = 1358998; times[4693] = 1355260; times[4694] = 1349865; times[4695] = 1340824; times[4696] = 1331263; times[4697] = 1319478; times[4698] = 1308620; times[4699] = 1297191; times[4700] = 1288104; times[4701] = 1279833; times[4702] = 1274956; times[4703] = 1271704;
    times[4704] = 1272337; times[4705] = 1274719; times[4706] = 1280828; times[4707] = 1288151; times[4708] = 1298386; times[4709] = 1308768; times[4710] = 1320658; times[4711] = 1331337; times[4712] = 1341774; times[4713] = 1349752; times[4714] = 1355784; times[4715] = 1358747; times[4716] = 1358574; times[4717] = 1355634; times[4718] = 1349290; times[4719] = 1341326; times[4720] = 1330665; times[4721] = 1320037; times[4722] = 1308056; times[4723] = 1297776; times[4724] = 1287575; times[4725] = 1280421; times[4726] = 1274424; times[4727] = 1272279;
    times[4728] = 1271781; times[4729] = 1275285; times[4730] = 1280260; times[4731] = 1288720; times[4732] = 1297807; times[4733] = 1309308; times[4734] = 1320068; times[4735] = 1331810; times[4736] = 1341230; times[4737] = 1350101; times[4738] = 1355381; times[4739] = 1358879; times[4740] = 1358378; times[4741] = 1355513; times[4742] = 1349355; times[4743] = 1341043; times[4744] = 1330980; times[4745] = 1319702; times[4746] = 1308535; times[4747] = 1297443; times[4748] = 1288132; times[4749] = 1280102; times[4750] = 1274980; times[4751] = 1271940;
    times[4752] = 1272271; times[4753] = 1274883; times[4754] = 1280664; times[4755] = 1288237; times[4756] = 1298187; times[4757] = 1308769; times[4758] = 1320510; times[4759] = 1331226; times[4760] = 1341764; times[4761] = 1349507; times[4762] = 1355975; times[4763] = 1358362; times[4764] = 1358917; times[4765] = 1355135; times[4766] = 1349705; times[4767] = 1340824; times[4768] = 1331130; times[4769] = 1319624; times[4770] = 1308538; times[4771] = 1297427; times[4772] = 1288046; times[4773] = 1280087; times[4774] = 1274875; times[4775] = 1271907;
}
// 返回农历 y 年的总天数
int Calendar::getLunarYearDays(int year)
{
    int i = 0, sum = 348;
    for (i = 0x8000; i > 0x8; i >>= 1)
    {
        sum += (lunarInfo[(size_t)year - 1900] & i) ? 1 : 0;
    }
    return sum + getLunarLeapDays(year);
}
// 返回农历 y 年闰月的天数
int Calendar::getLunarLeapDays(int year)
{
    if (getLunarLeapMonth(year))
    {
        return (lunarInfo[(size_t)year - 1899] & 0xf) == 0xf ? 30 : 29;
    }
    else {
        return 0;
    }
}
// 返回农历 y 年闰哪个月 1-12 , 没闰返回 0
int Calendar::getLunarLeapMonth(int year)
{
    int r = lunarInfo[(size_t)year - 1900] & 0xf;
    return r == 0xf ? 0 : r;
}
// 返回农历 y 年 m 月的总天数
int Calendar::getLunarMonthDays(int year, int month)
{
    return(lunarInfo[(size_t)year - 1900] & (0x10000 >> month)) ? 30 : 29;
}

// 某年的第 n 个节气为几日 (从 0 小寒起算)
int Calendar::getLunarSTerm(int year, int n, std::string& result)
{
    int yearDiff = year - 1900;
    int up = yearDiff * 24 + n;

    INT64 rec = 0;
    for (int i = 0; i < up; i++)
    {
        rec = rec + times[i];
    }

    std::string r = GetDateFromTimeDiffAndBase("19000106020357", rec);
    result = r;
    
    int re = std::stoi(r.substr(6, 2));
    return re;
}
// 传入 offset 返回干支, 0=甲子
std::string Calendar::getJiazi(int num)
{
    return tianGan[num % 10] + diZhi[num % 12];
}
// 根据基准日期时间和相差的秒钟算 另一个日期 格式 YYYYMMDDHHMMSS ，相差秒钟分正(向前)负(向后)
std::string Calendar::GetDateFromTimeDiffAndBase(const std::string &date, INT64 seconds)
{
    if (date.length() == 0) return "";
    int year = 0, month = 0, day = 0, i = 0;
    int hour = 0, minute = 0, second = 0;
    char c;

    INT64 n = 0;
    INT64 num = seconds / (24 * 3600);

    int second_yu = seconds % (24 * 3600);

    if (second_yu < 0)
    {
        second_yu = -second_yu;
    }

    GetDateTimeFromStandardString(date, year, month, day, hour, minute, second);

    int basic_second = hour * 3600 + minute * 60 + second;

    if (num < 0)
    {
        c = '-';
        n = -num;
    }
    else
    {
        c = '+';
        n = num;
    }
    for (i = 0; i < n; i++)
    {
        if (c == '-')
        {
            day--;
            if (day == 0)
            {
                month--;
                if (month == 0)
                {
                    month = 12;
                    year--;
                }
                switch (month)
                {
                case 1:
                case 3:
                case 5:
                case 7:
                case 8:
                case 10:
                case 12: {day = 31; break; }
                case 4:
                case 6:
                case 9:
                case 11: {day = 30; break; }
                case 2: {
                    if (IsLeapYear(year)) day = 29;
                    else day = 28;
                    break;
                }
                };
            }
        }
        else
        {
            day++;
            switch (month)
            {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12: {
                if (day == 32)
                {
                    day = 1;
                    month++;
                }
                break;
            }
            case 4:
            case 6:
            case 9:
            case 11: {
                if (day == 31)
                {
                    day = 1;
                    month++;
                }
                break;
            }
            case 2: {
                if (IsLeapYear(year))
                {
                    if (day == 30)
                    {
                        day = 1;
                        month++;
                    }
                }
                else
                {
                    if (day == 29)
                    {
                        day = 1;
                        month++;
                    }
                }
                break;
            }
            };
            if (month == 13)
            {
                month = 1;
                year++;
            }
        }
    }

    int s_hour = 0, s_minute = 0, s_second = 0;

    if (c == '-')
    {
        int secdiff = basic_second - second_yu;
        if (secdiff >= 0)
        {
            s_hour = secdiff / 3600;
            s_minute = (secdiff % 3600) / 60;
            s_second = secdiff - s_hour * 3600 - s_minute * 60;
        }
        else
        {
            std::string d = GetStandardDate(year, month, day);
            std::string dates = GetPreDayFromDate(d);
            int t = 24 * 3600 + secdiff;
            s_hour = t / 3600;
            s_minute = (t % 3600) / 60;
            s_second = t - s_hour * 3600 - s_minute * 60;
            GetDateFromStandardString(dates, year, month, day);
        }
    }
    else
    {
        int secdiff = basic_second + second_yu;
        if (secdiff > (24 * 3600))
        {
            std::string d = GetStandardDate(year, month, day);
            std::string dates = GetAfterDayFromDate(d);
            secdiff = secdiff - 24 * 3600;

            s_hour = secdiff / 3600;
            s_minute = (secdiff % 3600) / 60;
            s_second = secdiff - s_hour * 3600 - s_minute * 60;
            GetDateFromStandardString(dates, year, month, day);
        }
        else
        {
            s_hour = secdiff / 3600;
            s_minute = (secdiff % 3600) / 60;
            s_second = secdiff - s_hour * 3600 - s_minute * 60;
        }
    }
    std::string result = GetStandardDateTime(year, month, day, s_hour, s_minute, s_second);
    return result;
}
// 返回一个公历日期的后一天的日期, 格式 YYYYMMDD，未检查输入日期的合法性。
std::string Calendar::GetAfterDayFromDate(const std::string &date)
{
    int year = 0;
    int month = 0;
    int day = 0;
    GetDateFromStandardString(date, year, month, day);

    int r_year = 0;
    int r_month = 0;
    int r_day = 0;

    int upDay = 0;

    switch (month) {
    case 1:
    case 3:
    case 5:
    case 7:
    case 8:
    case 10:
    case 12:
    {
        upDay = 31;
        break;
    }
    case 2:
    {
        if (IsLeapYear(year))
        {
            upDay = 29;
        }
        else
        {
            upDay = 28;
        }
        break;
    }
    default:
        upDay = 30;
    }

    if (month <= 11)
    {
        r_year = year;
        if (day == upDay)
        {
            r_month = month + 1;
            r_day = 1;
        }
        else
        {
            r_month = month;
            r_day = day + 1;
        }
    }
    else if (month == 12)
    {
        if (day == upDay)
        {
            r_year = year + 1;
            r_month = 1;
            r_day = 1;
        }
        else
        {
            r_year = year;
            r_month = 12;
            r_day = day + 1;
        }
    }
    return GetStandardDate(r_year, r_month, r_day);
}
// 返回一个公历日期的前一天的日期, 格式 YYYYMMDD，未检查输入日期的合法性。
std::string Calendar::GetPreDayFromDate(const std::string &date)
{
    int year = 0;
    int month = 0;
    int day = 0;
    GetDateFromStandardString(date, year, month, day);

    int r_year = 0;
    int r_month = 0;
    int r_day = 0;

    if (day > 1)
    {
        std::string r = date.substr(0, 6);
        std::string t = r + TurnWithZero(day - 1);
        return t;
    }
    if (day == 1)
    {
        if (month > 1)
        {
            r_year = year;
            if ((month - 1) == 2)
            {
                if (IsLeapYear(year))
                {
                    r_month = 2;
                    r_day = 29;
                    return GetStandardDate(r_year, r_month, r_day);
                }
                else
                {
                    r_month = 2;
                    r_day = 28;
                    return GetStandardDate(r_year, r_month, r_day);
                }
            }
            int m = month - 1;
            switch (m) {
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            {
                r_day = 31;
                break;
            }
            default:
                r_day = 30;
            }
            r_month = m;
            return GetStandardDate(r_year, r_month, r_day);
        }
        else if (month == 1)
        {
            r_year = year - 1;
            r_month = 12;
            r_day = 31;
            return GetStandardDate(r_year, r_month, r_day);
        }
    }
    return "";
}
// 判断是否是闰年
bool Calendar::IsLeapYear(int year)
{
    if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) return true;
    return false;
}
// 让月、日、时、分、秒为个数时首位加 0
std::string Calendar::TurnWithZero(long num)
{
    std::string r = std::to_string(num);
    if (r.length() == 1) r = "0" + r;
    return r;
}
// 录入公历日期（同一个对象可以反复调用），如果日期不合法，返回 false
bool Calendar::SetSolarDate(int year, int month, int day, int hour, int min, int second)
{
    std::string nowTime = GetStandardDateTime(year, month, day, hour, min, second);

    if (!IsDateTimeLegal(nowTime))
    {
        return false;
    }

    Init();

    this->solarYear = year;
    this->solarMonth = month;
    this->solarDay = day;
    this->solarHour = hour;
    this->solarMin = min;
    this->solarSecond = second;

    std::string strDate = GetStandardDate(year, month, day);
    // int week = GetWeekIndexFromDate(strDate);
    if (year < 1900 || year > 2100) return false;

    // 返回两个日期之间的天数差 参数为 YYYYMMDD
    int offset = GetDayDiffTwo(strDate, "19000131");

    int i = 0, leap = 0, temp = 0;
    for (i = 1900; i < 2100 && offset >0; i++)
    {
        temp = getLunarYearDays(i);
        offset -= temp;
    }
    if (offset < 0)
    {
        offset += temp;
        i--;
    }
    lunarYear = i;
    leap = getLunarLeapMonth(i); // 闰哪个月
    isLeapMonth = false;
    for (i = 1; i < 13 && offset > 0; i++)
    {
        //闰月
        if (leap > 0 && i == (leap + 1) && (!isLeapMonth))
        {
            --i;
            isLeapMonth = true;
            temp = getLunarLeapDays(lunarYear);
        }
        else
        {
            temp = getLunarMonthDays(lunarYear, i);
        }

        //解除闰月
        if (isLeapMonth == true && i == (leap + 1))
            isLeapMonth = false;

        offset -= temp;
    }
    if (offset == 0 && leap > 0 && i == leap + 1)
    {
        if (isLeapMonth)
        {
            isLeapMonth = false;
        }
        else
        {
            isLeapMonth = true;
            --i;
        }
    }
    if (offset < 0)
    {
        offset += temp;
        --i;
    }
    lunarMonth = i;
    lunarDay = offset + 1;
    isBigMonth = (isLeapMonth ? getLunarLeapDays(lunarYear) : getLunarMonthDays(lunarYear, lunarMonth)) > 29 ? true : false;

    // ********************* 节气 *******************************1900 01 01 02 03 05
    std::string jieQiTime1 = "";
    std::string jieQiTime2 = "";

    int ms1 = getLunarSTerm(year, (month - 1) * 2, jieQiTime1);
    int ms2 = getLunarSTerm(year, (month - 1) * 2 + 1, jieQiTime2);

    jieQiOne = TurnWithZero(month) + "-" + TurnWithZero(ms1) + "-" + jieQiInfoIndex[(month - 1) * 2] +
        "-" + "时间" + "-" + jieQiTime1.substr(8, 2) + ":" + jieQiTime1.substr(10, 2) + ":" + jieQiTime1.substr(12, 2);
    jieQiTwo = TurnWithZero(month) + "-" + TurnWithZero(ms2) + "-" + jieQiInfoIndex[(month - 1) * 2 + 1] +
        "-" + "时间" + "-" + jieQiTime2.substr(8, 2) + ":" + jieQiTime2.substr(10, 2) + ":" + jieQiTime2.substr(12, 2);

    // 日柱是对的
    int r = GetDayDiffFromBase(strDate);
    // 夜晚11点以后算第二天
    if (solarHour == 23)
    {
        r++;
    }
    lunarDayZhu = getJiazi(r + 10);

    // ********************* 三柱 *******************************
    getYearMonthZhu();
    getHourZhu();
    /*****************************************************************/
    return true;
}
// 判断时间是否合法 HHMMSS
bool Calendar::IsTimeLegal(const std::string &time)
{
    if (time == "" || time.length() != 6) return false;
    int h = 0;
    int m = 0;
    int s = 0;
    GetTimeFromStandardString(time, h, m, s);
    if ((h > 23) || (h < 0))
        return false;
    if ((m > 59) || (m < 0))
        return false;
    if ((s > 59) || (s < 0))
        return false;
    return true;
}
// 判断日期时间是否合法 YYYYMMDDHHMMSS
bool Calendar::IsDateTimeLegal(const std::string &dateTime)
{
    if (dateTime == "" || dateTime.length() != 14) return false;
    if (!IsSolarLegal(dateTime.substr(0, 8))) return false;
    if (!IsTimeLegal(dateTime.substr(8, 6))) return false;
    return true;
}
// 判断公历是否合法 YYYYMMDD
bool Calendar::IsSolarLegal(const std::string &date)
{
    if (date == "" || date.length() != 8) return false;

    int y = 0;
    int m = 0;
    int d = 0;
    GetDateFromStandardString(date, y, m, d);

    if (m > 12 || m < 1) return false;
    if (IsLeapYear(y))
    {
        if (m == 2)
        {
            if ((d > 29) || (d < 1))
                return false;
        }
    }
    else
    {
        if (m == 2)
        {
            if ((d > 28) || (d < 1))
                return false;
        }
    }
    if ((m == 1) || (m == 3) || (m == 5) || (m == 7) || (m == 8) || (m == 10) || (m == 12))
    {
        if ((d > 31) || (d < 1))
            return false;
    }
    if ((m == 4) || (m == 6) || (m == 9) || (m == 11))
    {
        if ((d > 30) || (d < 1))
            return false;
    }
    return true;
}
// 返回两个日期之间的天数差 参数为 YYYYMMDD
int Calendar::GetDayDiffTwo(const std::string &one, const std::string &two)
{
    if ((!IsSolarLegal(one)) || (!IsSolarLegal(two))) return -1;
    int a = GetDayDiffFromBase(one);
    int b = GetDayDiffFromBase(two);
    return a - b;
}
// 返回距离 1900.1.1 的天数 格式 YYYYMMDD
int Calendar::GetDayDiffFromBase(const std::string &date)
{
    int y = 0;
    int m = 0;
    int d = 0;
    GetDateFromStandardString(date, y, m, d);

    int yearDiff = 0;
    int monthDiff = 0;
    int dayDiff = 0;

    int sum = 0;

    if (y >= 1900)
    {
        for (int i = 1900; i < y; i++)
        {
            if (IsLeapYear(i))
                yearDiff = yearDiff + 366;
            else yearDiff = yearDiff + 365;
        }
        for (int i = 1; i < m; i++)
        {
            switch (i)
            {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12: monthDiff = monthDiff + 31; break;
            case 4:
            case 6:
            case 9:
            case 11: monthDiff = monthDiff + 30; break;
            case 2: {
                if (IsLeapYear(y))
                    monthDiff = monthDiff + 29;
                else
                    monthDiff = monthDiff + 28;
                break;
            }
            }
        }
        dayDiff = d - 1;
        sum = yearDiff + monthDiff + dayDiff;
    }
    else
    {
        for (int i = y; i < 1900; i++)
        {
            if (IsLeapYear(i))
                yearDiff = yearDiff + 366;
            else yearDiff = yearDiff + 365;

        }
        for (int i = 1; i < m; i++)
        {
            switch (i)
            {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12: monthDiff = monthDiff + 31; break;
            case 4:
            case 6:
            case 9:
            case 11: monthDiff = monthDiff + 30; break;
            case 2: {
                if (IsLeapYear(y))
                    monthDiff = monthDiff + 29;
                else
                    monthDiff = monthDiff + 28;
                break;
            }
            }
        }
        dayDiff = d - 1;
        sum = yearDiff - monthDiff - dayDiff;
        sum = -sum;
    }
    return sum;
}
#ifdef _WIN32
// 获取当前系统日期时间，精确到毫秒 格式 YYYYMMDDHHMMSSMIL
std::string Calendar::GetSysDateTimeMill()
{
    //typedef struct _SYSTEMTIME
    //{
    //    WORD wYear;//年  
    //    WORD wMonth;//月  
    //    WORD wDayOfWeek;//星期：0为星期日，1为星期一，2为星期二……  
    //    WORD wDay;//日  
    //    WORD wHour;//时  
    //    WORD wMinute;//分  
    //    WORD wSecond;//秒  
    //    WORD wMilliseconds;//毫秒  
    //}SYSTEMTIME, * PSYSTEMTIME;
    std::string result = "";
    SYSTEMTIME systemtime;
    GetLocalTime(&systemtime);
    result += TurnWithZero(systemtime.wYear);
    result += TurnWithZero(systemtime.wMonth);
    result += TurnWithZero(systemtime.wDay);
    result += TurnWithZero(systemtime.wHour);
    result += TurnWithZero(systemtime.wMinute);
    result += TurnWithZero(systemtime.wSecond);
    result += TurnWithZero(systemtime.wMilliseconds);
    return result;
}
#else
// 获取当前系统日期时间，精确到毫秒 格式 YYYYMMDDHHMMSSMIL
std::string Calendar::GetSysDateTimeMill()
{
    std::string result = "";
    struct tm* tp = NULL;
    time_t t;
    time(&t);
    tp = localtime(&t);
    timeval tv;
    gettimeofday(&tv, NULL);
    result += TurnWithZero(tp->tm_year + 1900);
    result += TurnWithZero(tp->tm_mon + 1);
    result += TurnWithZero(tp->tm_mday);
    result += TurnWithZero(tp->tm_hour);
    result += TurnWithZero(tp->tm_min);
    result += TurnWithZero(tp->tm_sec);
    result += TurnWithZero(tv.tv_usec / 1000);
    return result;
}
#endif
// 返回两个时间点的秒数之差 参数都为 HHMMSS
int Calendar::GetTimeDiffTwo(const std::string &one, const std::string &two)
{
    if ((!IsTimeLegal(one)) || (!IsTimeLegal(two))) return -1;
    int a = GetMiaoDiffToZero(one);
    int b = GetMiaoDiffToZero(two);
    return a - b;
}
// 返回一个时间到 00:00:00 的秒数 ，输入 HHMMSS
int Calendar::GetMiaoDiffToZero(const std::string &time)
{
    int h = 0;
    int m = 0;
    int s = 0;
    GetTimeFromStandardString(time, h, m, s);
    return h * 3600 + m * 60 + s;
}
// 判断中间的日期是否在前后两个日期之间 格式 YYYYMMDDHHMMSS
bool Calendar::IsDateBetweenAC(const std::string &one, const std::string &two, const std::string &three)
{
    INT64 onediff = GetDateTimeDiffTwo("19000101000000", one);
    INT64 twodiff = GetDateTimeDiffTwo("19000101000000", two);
    INT64 threediff = GetDateTimeDiffTwo("19000101000000", three);

    if ((twodiff - onediff) >= 0 && (twodiff - threediff) <= 0)
    {
        return true;
    }
    return false;
}
// 根据日期 YYYYMMDD 返回这一天是星期几 0-周日， 1-周一 以此类推
int Calendar::GetWeekIndexFromDate(const std::string &date)
{
    if (date.length() == 0) return -1;

    int iyear = 0, imonth = 0, iday = 0, weeknum = 0, daycha = 0, wkcha = 0, flag = 0;
    struct tm newtime;

    iyear = 0;
    imonth = 0;
    iday = 0;
    GetDateFromStandardString(date, iyear, imonth, iday);

    iyear = iyear - 1900;
    imonth = imonth - 1;

    newtime.tm_sec = 0;
    newtime.tm_min = 0;
    newtime.tm_hour = 0;
    newtime.tm_mday = iday;
    newtime.tm_mon = imonth;
    newtime.tm_year = iyear;
    mktime(&newtime);

    // 结果
    weeknum = newtime.tm_wday;

    // 是否命中 0-6
    bool isDone = false;
    if (weeknum >= 0 && weeknum <= 6)
        isDone = true;

    if (!isDone)
    {
        /*20120707 add */
        /*返回某一天的星期*/
        /*当利用平常天数求不出星期来的话，那么利用此办法*/
        /*以两千零零年一月一日是星期六为基础*/
        /*利用基数办法求星期*/
        daycha = GetDayDiffTwo(date, "20000101");
        if (daycha < 0)
        {
            flag = 1;
            daycha = -daycha;
        }
        wkcha = daycha % 7;
        if (flag == 0)
        {
            wkcha = (wkcha + 6) % 7;
        }
        else {
            wkcha = 6 - wkcha;
        }
        weeknum = wkcha;
    }
    return weeknum;
}
// 计算农历年的 年柱、月柱 (以立春为新年)
void Calendar::getYearMonthZhu()
{
    // 以公历 1900 年 01 月 6 日时为起始日期 （小寒）
    // 对应农历日期为 1900 年 己亥年，丁丑月 (以立春为新年)
    std::string yearZhu = "己亥";
    int year = 1900;
    int month = 1;
    std::string monthZhu = "丁丑";
    // 起始日期所处的节气是 什么
    std::string jieQi = "小寒";
    std::string firstJieQiName;

    // 生成节气的时间 假设 某年 02-04-立春-时间13:12:44  02-19-雨水-时间20:01:14
    std::string startJieQiTime = getJieQiStandardTime(solarYear, jieQiOne, firstJieQiName);

    int n1 = (solarYear - 1900) * 24 + jieQiInfo[firstJieQiName];

    for (int i = 0; i < n1; i++)
    {
        getNexJieQiInfo(year, month, jieQi, monthZhu, yearZhu);
    }

    // 计算两个日期时间之间相差的秒数 参数为 YYYYMMDDHHMMSS
    std::string nowTime = GetStandardDateTime(solarYear, solarMonth, solarDay, solarHour, solarMin, solarSecond);
    INT64 re = GetDateTimeDiffTwo(startJieQiTime, nowTime);
    if (re < 0)
    {
        lunarYearZhu = yearZhu;
        lunarMonthZhu = monthZhu;
    }
    else
    {
        // 给出某年某月的年柱、月柱、返回上一个月的年柱、月柱。
        //std::string Calendar::getPreMonthYearMothZhu(int year, int month, std::string yearZhu, std::string monthZhu, bool isLiChun)
        std::string c = "";
        if (firstJieQiName == "立春")
        {
            c = getPreMonthYearMothZhu(year, month, yearZhu, monthZhu, true);
        }
        else
        {
            c = getPreMonthYearMothZhu(year, month, yearZhu, monthZhu, false);
        }
        lunarYearZhu = zhSubstr(c, 4, 0, 2);
        lunarMonthZhu = zhSubstr(c, 4, 2, 2);
    }
}
// 将格式为 【04-04-清明-时间-13:12:44】的字符串转成 YYYYMMDDHHMMSS 标准格式，节气名称保存到 jieQi 中
std::string Calendar::getJieQiStandardTime(int year, const std::string &time, std::string& jieQi)
{
    if (time == "")
    {
        jieQi = "";
        return "";
    }

    std::vector<std::string> result;
    SplitString(time, "-", result);
    std::string times = result.at(4);

    std::string mon = result.at(0);
    std::string day = result.at(1);
    std::string h = times.substr(0, 2);
    std::string m = times.substr(3, 2);
    std::string s = times.substr(6, 2);
    jieQi = result.at(2);

    std::string re = std::to_string(year) + mon + day + h + m + s;
    return re;
}
// 计算两个日期时间之间相差的秒数 参数为 YYYYMMDDHHMMSS
INT64 Calendar::GetDateTimeDiffTwo(const std::string &one, const std::string &two)
{
    if (one == "" || two == "" || (one.length() != 14) || (two.length() != 14)) return -1;

    INT64 result = 0;

    std::string date1 = one.substr(0, 8);
    std::string time1 = one.substr(8, 6);
    std::string date2 = two.substr(0, 8);
    std::string time2 = two.substr(8, 6);

    INT64 t1 = GetTimeDiffTwo(time1, time2);
    INT64 t2 = GetDayDiffTwo(date1, date2);
    result = t1 + t2 * 86400;

    return result;
}
// 传入公历的年、月、此月的节气、此月的月柱、此年柱 -> 获取该节气的下一个节气的 年、月、节气、月柱、年柱(YYYYMMXXPPYY)
void Calendar::getNexJieQiInfo(int &year, int &month, std::string &jieQi, std::string &monthZhu, std::string &yearZhu)
{
    // 1990 1 小寒 丁丑
    int startIndex = jieQiInfo[jieQi];

    // 下一个节气还是当月
    if ((startIndex % 2) == 0)
    {
        jieQi = jieQiInfoIndex[(startIndex + 1) % 24];
    }
    else
    {
        int tmp_nextMonth = month + 1;
        if (tmp_nextMonth > 12)
        {
            year = year + 1;
            month = 1;
        }
        else
        {
            month = tmp_nextMonth;
        }
        jieQi = jieQiInfoIndex[(jieQiInfo[jieQi] + 1) % 24];
        if (jieQi == "立春")
        {

            std::string tmp = getNextYearYearMonthZhu(yearZhu);
            yearZhu = zhSubstr(tmp, 4, 0, 2);
            monthZhu = zhSubstr(tmp, 4, 2, 2);
        }
        else
        {
            monthZhu = sixtyJiazi[(sixtyJiaziIndex[monthZhu] + 1) % 60];
        }
    }
}
// 给出年柱，返回下一年的年柱和起始月柱， 格式 XX
std::string Calendar::getNextYearYearMonthZhu(const std::string &yearZhu)
{
    std::string nextYearZhu = sixtyJiazi[(sixtyJiaziIndex[yearZhu] + 1) % 60];
    std::string TG = zhSubstr(nextYearZhu, 2, 0, 1);
    std::string nextMonthZhu = wuHu[TG] + "寅";
    return nextYearZhu + nextMonthZhu;
}
// 给出某年某月的年柱、月柱、返回上一个月的年柱、月柱。
std::string Calendar::getPreMonthYearMothZhu(int year, int month, const std::string &yearZhu, const std::string &monthZhu, bool isLiChun)
{
    std::string resultYearZhu = "";
    std::string resultMonthZhu = "";

    if (isLiChun)
    {
        int currentYearZhuIndex = sixtyJiaziIndex[yearZhu];
        int pre = getRemainder(currentYearZhuIndex - 1, 60);
        resultYearZhu = sixtyJiazi[pre];
        std::string startYueZhu = wuHu[zhSubstr(resultYearZhu, 2, 0, 1)] + "寅";
        resultMonthZhu = sixtyJiazi[(sixtyJiaziIndex[startYueZhu] + 11) % 60];
    }
    else
    {
        resultYearZhu = yearZhu;
        int currentMonthZhuIndex = sixtyJiaziIndex[monthZhu];
        int pre = getRemainder(currentMonthZhuIndex - 1, 60);
        resultMonthZhu = sixtyJiazi[pre];
    }
    return resultYearZhu + resultMonthZhu;
}
// 对 num 取余，jinZhi 为基数，num 支持负数，结果在 [0, jinZhi-1]内
unsigned int Calendar::getRemainder(int num, int jinZhi)
{
    int tmp = num % jinZhi;
    if (tmp >= 0)
    {
        return tmp;
    }
    else
    {
        tmp = tmp + jinZhi;
        return tmp;
    }
}
// 计算时柱 (该函数要在计算年柱月柱之后执行)
void Calendar::getHourZhu()
{
    std::string t = zhSubstr(lunarDayZhu, 2, 0, 1);
    std::string startTimeZhu = qiShi[t] + "子";
    int index = sixtyJiaziIndex[startTimeZhu];
    int tmp_time = solarHour + 1;
    if (tmp_time == 24)
    {
        tmp_time = 0;
    }
    int add_num = tmp_time / 2;
    lunarHourZhu = sixtyJiazi[(index + add_num) % 60];
}
// 字符串分割
void Calendar::SplitString(const std::string& data, std::string splitString, std::vector<std::string>& result)
{
    result.clear();
    std::string sCopy = data;
    size_t iPosEnd = 0;
    while (true)
    {
        iPosEnd = sCopy.find(splitString);
        if (iPosEnd == std::string::npos)
        {
            result.push_back(sCopy);
            break;
        }
        result.push_back(sCopy.substr(0, iPosEnd));
        sCopy = sCopy.substr(iPosEnd + 1);
    }
}
// 对于纯中文（注意不能字符和中文夹杂）的 substr (参数，num 为该字符串有几个中文汉字)
std::string Calendar::zhSubstr(const std::string& data, int num, size_t start, size_t length)
{
    std::string result = "";
    size_t single = data.length() / num;
    result = data.substr(start * single, length * single);
    return result;
}
// 传入年月日给出标准 YYYYMMDD 格式
std::string Calendar::GetStandardDate(int year, int month, int day)
{
    std::string result;
    result = std::to_string(year) + TurnWithZero(month) + TurnWithZero(day);
    return result;
}

// 传入标准 YYYYMMDD 格式，返回年月日
void Calendar::GetDateFromStandardString(const std::string& datetime, int& year, int& month, int& day)
{
    year = std::stoi(datetime.substr(0, 4));
    month = std::stoi(datetime.substr(4, 2));
    day = std::stoi(datetime.substr(6, 2));
}

// 传入年月日时分秒给出标准 YYYYMMDDHHMMSS 格式
std::string Calendar::GetStandardDateTime(int year, int month, int day, int hour, int min, int sec)
{
    std::string result;
    result = std::to_string(year) + TurnWithZero(month) + TurnWithZero(day) +
        TurnWithZero(hour) + TurnWithZero(min) + TurnWithZero(sec);
    return result;
}

// 传入标准 YYYYMMDDHHMMSS 格式, 返回年月日时分秒
void Calendar::GetDateTimeFromStandardString(const std::string& datetime, int& year, int& month, int& day, int& hour, int& min, int& sec)
{
    year = std::stoi(datetime.substr(0, 4));
    month = std::stoi(datetime.substr(4, 2));
    day = std::stoi(datetime.substr(6, 2));
    hour = std::stoi(datetime.substr(8, 2));
    min = std::stoi(datetime.substr(10, 2));
    sec = std::stoi(datetime.substr(12, 2));
}
// 传入时分秒给出标准 HHMMSS 格式
std::string Calendar::GetStandardTime(int hour, int min, int sec)
{
    std::string result;
    result = TurnWithZero(hour) + TurnWithZero(min) + TurnWithZero(sec);
    return result;
}

// 传入标准 HHMMSS 时间格式返回时分秒
void Calendar::GetTimeFromStandardString(const std::string time, int &hour, int &min, int &sec)
{
    hour = std::stoi(time.substr(0, 2));
    min = std::stoi(time.substr(2, 2));
    sec = std::stoi(time.substr(4, 2));
}

// 给出 YYYYMMDDHHMMSS（包含节气的日期） 和节气名字，返回该节气的下一个节气的日期，和名字，返回格式 YYYYMMDDHHMMSS
void Calendar::GetNextJieQiDateTime(const std::string& datetime, const std::string& jieQiName, std::string& nextDatetime, std::string& nextJieQiName)
{
    int year = std::stoi(datetime.substr(0, 4));
    int index = jieQiInfo[jieQiName];

    nextJieQiName = jieQiInfoIndex[(index + 1) % 24];
    int diffsec = times[(year - 1900) * 24 + index + 1];
    nextDatetime = GetDateFromTimeDiffAndBase(datetime, diffsec);
}

// 给出 YYYYMMDDHHMMSS（包含节气的日期） 和节气名字，返回该节气的上一个节气的日期，和名字，返回格式 YYYYMMDDHHMMSS
void Calendar::GetPreJieQiDateTime(const std::string& datetime, const std::string& jieQiName, std::string& preDatetime, std::string& preJieQiName)
{
    int year = std::stoi(datetime.substr(0, 4));
    int index = jieQiInfo[jieQiName];

    preJieQiName = jieQiInfoIndex[getRemainder(index - 1, 24)];
    int diffindex = (year - 1900) * 24 + index - 1;
    int diffsec = times[diffindex];
    preDatetime = GetDateFromTimeDiffAndBase(datetime, -diffsec);
}